fix:
This commit is contained in:
parent
466a81903a
commit
b2d7f4e1c5
3 changed files with 6 additions and 9 deletions
|
@ -2,7 +2,6 @@ package models
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"git.sch9.ru/new_gate/ms-tester/internal/lib"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type Result int32
|
type Result int32
|
||||||
|
@ -10,12 +9,12 @@ type Result int32
|
||||||
const (
|
const (
|
||||||
NotTested Result = 1 // change only with schema change
|
NotTested Result = 1 // change only with schema change
|
||||||
Accepted Result = 2
|
Accepted Result = 2
|
||||||
WrongAnswer Result = 3
|
WrongAnswer Result = 3
|
||||||
PresentationError Result = 4
|
PresentationError Result = 4
|
||||||
CompilationError Result = 5
|
CompilationError Result = 5
|
||||||
MemoryLimitExceeded Result = 6
|
MemoryLimitExceeded Result = 6
|
||||||
TimeLimitExceeded Result = 7
|
TimeLimitExceeded Result = 7
|
||||||
RuntimeError Result = 8
|
RuntimeError Result = 8
|
||||||
SystemFailDuringTesting Result = 9
|
SystemFailDuringTesting Result = 9
|
||||||
Testing Result = 10
|
Testing Result = 10
|
||||||
)
|
)
|
||||||
|
@ -27,5 +26,5 @@ func (result Result) Valid() error {
|
||||||
case NotTested, Accepted, TimeLimitExceeded, MemoryLimitExceeded, CompilationError, SystemFailDuringTesting:
|
case NotTested, Accepted, TimeLimitExceeded, MemoryLimitExceeded, CompilationError, SystemFailDuringTesting:
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
return lib.ServiceError(ErrBadResult, lib.ErrValidationFailed, "bad result")
|
return ErrBadResult
|
||||||
}
|
}
|
||||||
|
|
3
role.go
3
role.go
|
@ -2,7 +2,6 @@ package models
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"git.sch9.ru/new_gate/ms-tester/internal/lib"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type Role int32
|
type Role int32
|
||||||
|
@ -45,7 +44,7 @@ func (role Role) Valid() error {
|
||||||
case RoleSpectator, RoleParticipant, RoleModerator, RoleAdmin:
|
case RoleSpectator, RoleParticipant, RoleModerator, RoleAdmin:
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
return lib.ServiceError(ErrBadRole, lib.ErrValidationFailed, "bad role")
|
return ErrBadRole
|
||||||
}
|
}
|
||||||
|
|
||||||
func (role Role) AsPointer() *Role {
|
func (role Role) AsPointer() *Role {
|
||||||
|
|
|
@ -2,7 +2,6 @@ package models
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"git.sch9.ru/new_gate/ms-tester/internal/lib"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type TestingStrategy int32
|
type TestingStrategy int32
|
||||||
|
@ -30,5 +29,5 @@ func (ts TestingStrategy) Valid() error {
|
||||||
case EachTestTS, CompleteGroupTS:
|
case EachTestTS, CompleteGroupTS:
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
return lib.ServiceError(ErrBadTestingStrategy, lib.ErrValidationFailed, "bad testing strategy")
|
return ErrBadTestingStrategy
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue