87 lines
2.3 KiB
Go
87 lines
2.3 KiB
Go
package models
|
|
|
|
import "time"
|
|
|
|
type Solution struct {
|
|
Id int32 `db:"id"`
|
|
TaskId int32 `db:"task_id"`
|
|
ParticipantId int32 `db:"participant_id"`
|
|
Solution string `db:"solution"`
|
|
State int32 `db:"state"`
|
|
Score int32 `db:"score"`
|
|
Penalty int32 `db:"penalty"`
|
|
TotalScore int32 `db:"total_score"`
|
|
Language int32 `db:"language"`
|
|
UpdatedAt time.Time `db:"updated_at"`
|
|
CreatedAt time.Time `db:"created_at"`
|
|
}
|
|
|
|
type SolutionCreation struct {
|
|
Solution string
|
|
TaskId int32
|
|
ParticipantId int32
|
|
Language int32
|
|
Penalty int32
|
|
}
|
|
|
|
type SolutionsListItem struct {
|
|
Id int32 `db:"id"`
|
|
TaskId int32 `db:"task_id"`
|
|
ContestId int32 `db:"contest_id"`
|
|
ParticipantId int32 `db:"participant_id"`
|
|
State int32 `db:"state"`
|
|
Score int32 `db:"score"`
|
|
Penalty int32 `db:"penalty"`
|
|
TotalScore int32 `db:"total_score"`
|
|
Language int32 `db:"language"`
|
|
UpdatedAt time.Time `db:"updated_at"`
|
|
CreatedAt time.Time `db:"created_at"`
|
|
}
|
|
|
|
type SolutionsFilter struct {
|
|
Page int32
|
|
PageSize int32
|
|
ContestId *int32
|
|
ParticipantId *int32
|
|
TaskId *int32
|
|
Language *int32
|
|
State *int32
|
|
Order *int32
|
|
}
|
|
|
|
//type Result int32
|
|
//
|
|
//const (
|
|
// NotTested Result = 1 // change only with schema change
|
|
// Accepted Result = 2
|
|
// WrongAnswer Result = 3
|
|
// PresentationError Result = 4
|
|
// CompilationError Result = 5
|
|
// MemoryLimitExceeded Result = 6
|
|
// TimeLimitExceeded Result = 7
|
|
// RuntimeError Result = 8
|
|
// SystemFailDuringTesting Result = 9
|
|
// Testing Result = 10
|
|
//)
|
|
//
|
|
//var ErrBadResult = errors.New("bad result")
|
|
//
|
|
//func (result Result) Valid() error {
|
|
// switch result {
|
|
// case NotTested, Accepted, TimeLimitExceeded, MemoryLimitExceeded, CompilationError, SystemFailDuringTesting:
|
|
// return nil
|
|
// }
|
|
// return ErrBadResult
|
|
//}
|
|
//
|
|
//type Language struct {
|
|
// Name string
|
|
// CompileCmd []string //source: src;result:executable
|
|
// RunCmd []string //source: executable
|
|
//}
|
|
//
|
|
//var Languages = []Language{
|
|
// {Name: "gcc std=c90",
|
|
// CompileCmd: []string{"gcc", "src", "-std=c90", "-o", "executable"},
|
|
// RunCmd: []string{"executable"}},
|
|
//}
|