domain

package
v1.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 12, 2026 License: AGPL-3.0 Imports: 3 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalcMaxScores

func CalcMaxScores(userSubms []SubmJoinScoreInfo) map[string]MaxScore

returns a map of task short ids to the max received score the user has received on a subm for that task

Types

type Eval

type Eval struct {
	UUID      uuid.UUID
	SubmUUID  uuid.UUID
	Stage     EvalStage
	ScoreUnit ScoreUnit

	Error *EvalError

	Subtasks []Subtask
	Groups   []TestGroup

	Tests []Test

	Checker    *string
	Interactor *string
	CpuLimMs   int
	MemLimKiB  int

	CreatedAt time.Time
}

func NewEval

func NewEval(uuid uuid.UUID, submUuid uuid.UUID, task srvc.Task) Eval

func (*Eval) CalculateScore

func (e *Eval) CalculateScore() ScoreInfo

CalculateScore calculates scoring information from an evaluation

type EvalError

type EvalError struct {
	Type    EvalErrorType
	Message *string
}

type EvalErrorType

type EvalErrorType string
const (
	ErrorTypeCompilation EvalErrorType = "compilation"
	ErrorTypeInternal    EvalErrorType = "internal"
)

type EvalStage

type EvalStage string
const (
	EvalStageWaiting   EvalStage = "waiting"
	EvalStageCompiling EvalStage = "compiling"
	EvalStageTesting   EvalStage = "testing"
	EvalStageFinished  EvalStage = "finished"
)

type MaxScore

type MaxScore struct {
	SubmUuid  uuid.UUID
	Received  int
	Possible  int
	FirstTime time.Time // first time the user got a score this high
}

max score the user has received on a subm for a specific task

type ScoreBarInfo

type ScoreBarInfo struct {
	Green  int // accepted tests
	Red    int // wrong/failed tests
	Gray   int // not reached tests
	Yellow int // in progress tests
	Purple int // evaluation error
}

ScoreBarInfo contains the percentage distribution of test results

type ScoreInfo

type ScoreInfo struct {
	ScoreBar      ScoreBarInfo
	ReceivedScore int
	PossibleScore int
	MaxCpuMs      int
	MaxMemKiB     int
	ExceededCpu   bool
	ExceededMem   bool
}

ScoreInfo contains all scoring related information for an evaluation

type ScoreUnit

type ScoreUnit string
const (
	ScoreUnitTest      ScoreUnit = "test"
	ScoreUnitTestGroup ScoreUnit = "group"
	ScoreUnitSubtask   ScoreUnit = "subtask"
)

type Subm

type Subm struct {
	UUID         uuid.UUID
	Content      string
	AuthorUUID   uuid.UUID
	TaskShortID  string
	LangShortID  string
	CurrEvalUUID uuid.UUID
	CreatedAt    time.Time
}

type SubmJoinEvalOld

type SubmJoinEvalOld struct {
	Subm Subm
	Eval Eval
}

type SubmJoinScoreInfo

type SubmJoinScoreInfo struct {
	SubmUuid    uuid.UUID
	TaskShortID string
	CreatedAt   time.Time
	ScoreInfo   ScoreInfo
}

type Subtask

type Subtask struct {
	Points      int
	Description string // short md spec
	StTests     []int  // subtask tests
}

type Test

type Test struct {
	Ac  bool // accepted
	Wa  bool // wrong answer
	Tle bool // time limit exceeded
	Mle bool // memory limit exceeded
	Re  bool // runtime error
	Ig  bool // ignored

	Reached  bool // reached by tester
	Finished bool // has finished

	InpSha256 string
	AnsSha256 string

	CpuMs  *int // cpu exec 'user' time in milliseconds (nullable)
	MemKiB *int // rss memory in kibibytes (nullable)
}

type TestGroup

type TestGroup struct {
	Points   int
	Subtasks []int
	TgTests  []int // test group tests
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL