course

package
v0.0.0-...-4b23463 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrEmptyAcademicID            = errors.New("empty academic id")
	ErrInvalidAcademicType        = errors.New("invalid academic type")
	ErrNotTeacherCantCreateCourse = errors.New("not teacher can't create course")
)
View Source
var (
	ErrEmptyCourseID    = errors.New("empty course id")
	ErrZeroCreator      = errors.New("empty course creator id")
	ErrEmptyCourseTitle = errors.New("empty course title")
	ErrZeroCoursePeriod = errors.New("zero course period")
)
View Source
var (
	ErrZeroExcellentGradeTime      = errors.New("zero excellent grade time")
	ErrZeroGoodGradeTime           = errors.New("zero good grade time")
	ErrExcellentGradeTimeAfterGood = errors.New("excellent grade time after good")
)
View Source
var (
	ErrStartYearAfterEnd      = errors.New("academic start year after end")
	ErrYearDurationOverYear   = errors.New("academic year duration over year")
	ErrStartYearEqualsEndYear = errors.New("academic start year equals end year")
	ErrInvalidSemester        = errors.New("invalid academic semester")
)
View Source
var (
	ErrTaskHasNoDeadline      = errors.New("task has no deadline")
	ErrTaskHasNoTestPoints    = errors.New("task has no test points")
	ErrTaskHasNoTestData      = errors.New("task has no test data")
	ErrTaskTitleTooLong       = errors.New("task title too long")
	ErrTaskDescriptionTooLong = errors.New("task description too long")
	ErrCourseHasNoSuchTask    = errors.New("course has no such task")
)
View Source
var (
	ErrTestInputDataTooLong  = errors.New("test input data too long")
	ErrTestOutputDataTooLong = errors.New("test output data too long")
)
View Source
var (
	ErrTestPointDescriptionTooLong     = errors.New("test point description too long")
	ErrEmptyTestPointVariants          = errors.New("empty test point variants")
	ErrEmptyTestPointCorrectVariants   = errors.New("test points has no correct variants")
	ErrTooMuchTestPointCorrectVariants = errors.New("test point has too much correct variants")
	ErrInvalidTestPointVariantNumber   = errors.New("invalid test point variant number")
)
View Source
var ErrCourseHasNoSuchCollaborator = errors.New("course has no such collaborator")
View Source
var ErrCourseHasNoSuchStudent = errors.New("course has no such student")

Functions

func IsAcademicCantEditCourseError

func IsAcademicCantEditCourseError(err error) bool

func IsInvalidCourseParametersError

func IsInvalidCourseParametersError(err error) bool

func IsInvalidDeadlineError

func IsInvalidDeadlineError(err error) bool

func IsInvalidTaskParametersError

func IsInvalidTaskParametersError(err error) bool

func IsInvalidTestDataError

func IsInvalidTestDataError(err error) bool

func IsInvalidTestPointError

func IsInvalidTestPointError(err error) bool

Types

type Academic

type Academic struct {
	// contains filtered or unexported fields
}

func MustNewAcademic

func MustNewAcademic(id string, t AcademicType) Academic

func NewAcademic

func NewAcademic(id string, t AcademicType) (Academic, error)

func (Academic) ID

func (a Academic) ID() string

func (Academic) IsZero

func (a Academic) IsZero() bool

func (Academic) Type

func (a Academic) Type() AcademicType

type AcademicCantEditCourseError

type AcademicCantEditCourseError struct {
	// contains filtered or unexported fields
}

func (AcademicCantEditCourseError) Error

type AcademicType

type AcademicType uint8
const (
	TeacherType AcademicType = iota + 1
	StudentType
)

func NewAcademicTypeFromString

func NewAcademicTypeFromString(value string) AcademicType

func (AcademicType) IsValid

func (at AcademicType) IsValid() bool

func (AcademicType) String

func (at AcademicType) String() string

type Access

type Access uint8
const (
	TeacherAccess Access = iota + 1
	CreatorAccess
)

func (Access) String

func (a Access) String() string

type AutoCodeCheckingTaskCreationParams

type AutoCodeCheckingTaskCreationParams struct {
	Title       string
	Description string
	Deadline    Deadline
	TestData    []TestData
}

type Course

type Course struct {
	// contains filtered or unexported fields
}

func MustNewCourse

func MustNewCourse(params CreationParams) *Course

func NewCourse

func NewCourse(params CreationParams) (*Course, error)

func UnmarshalFromDatabase

func UnmarshalFromDatabase(params UnmarshallingParams) *Course

UnmarshalFromDatabase unmarshalls Course from the database. It should be used only for unmarshalling from the database! Using UnmarshalFromDatabase may put domain into the invalid state!

func (*Course) AddAutoCodeCheckingTask

func (c *Course) AddAutoCodeCheckingTask(academic Academic, params AutoCodeCheckingTaskCreationParams) (int, error)

func (*Course) AddCollaborators

func (c *Course) AddCollaborators(academic Academic, teacherIDs ...string) error

func (*Course) AddManualCheckingTask

func (c *Course) AddManualCheckingTask(academic Academic, params ManualCheckingTaskCreationParams) (int, error)

func (*Course) AddStudents

func (c *Course) AddStudents(academic Academic, studentIDs ...string) error

func (*Course) AddTestingTask

func (c *Course) AddTestingTask(academic Academic, params TestingTaskCreationParams) (int, error)

func (*Course) Collaborators

func (c *Course) Collaborators() []string

func (*Course) CreatorID

func (c *Course) CreatorID() string

func (*Course) Extend

func (c *Course) Extend(params CreationParams) (*Course, error)

func (*Course) ID

func (c *Course) ID() string

func (*Course) Period

func (c *Course) Period() Period

func (*Course) RemoveCollaborator

func (c *Course) RemoveCollaborator(academic Academic, teacherID string) error

func (*Course) RemoveStudent

func (c *Course) RemoveStudent(academic Academic, studentID string) error

func (*Course) RenameTask

func (c *Course) RenameTask(academic Academic, taskNumber int, title string) error

func (*Course) ReplaceTaskDeadline

func (c *Course) ReplaceTaskDeadline(academic Academic, taskNumber int, deadline Deadline) error

func (*Course) ReplaceTaskDescription

func (c *Course) ReplaceTaskDescription(academic Academic, taskNumber int, description string) error

func (*Course) ReplaceTaskTestData

func (c *Course) ReplaceTaskTestData(academic Academic, taskNumber int, testData []TestData) error

func (*Course) ReplaceTaskTestPoints

func (c *Course) ReplaceTaskTestPoints(academic Academic, taskNumber int, testPoints []TestPoint) error

func (*Course) Started

func (c *Course) Started() bool

func (*Course) Students

func (c *Course) Students() []string

func (*Course) Task

func (c *Course) Task(taskNumber int) (Task, error)

func (*Course) Tasks

func (c *Course) Tasks() []Task

func (*Course) TasksNumber

func (c *Course) TasksNumber() int

func (*Course) Title

func (c *Course) Title() string

type CreationParams

type CreationParams struct {
	ID            string
	Creator       Academic
	Title         string
	Period        Period
	Started       bool
	Collaborators []string
	Students      []string
}

type Deadline

type Deadline struct {
	// contains filtered or unexported fields
}

func MustNewDeadline

func MustNewDeadline(excellentGradeTime time.Time, goodGradeTime time.Time) Deadline

func NewDeadline

func NewDeadline(excellentGradeTime time.Time, goodGradeTime time.Time) (Deadline, error)

func (Deadline) ExcellentGradeTime

func (d Deadline) ExcellentGradeTime() time.Time

func (Deadline) GoodGradeTime

func (d Deadline) GoodGradeTime() time.Time

func (Deadline) IsZero

func (d Deadline) IsZero() bool

func (Deadline) String

func (d Deadline) String() string

type ManualCheckingTaskCreationParams

type ManualCheckingTaskCreationParams struct {
	Title       string
	Description string
	Deadline    Deadline
}

type Period

type Period struct {
	// contains filtered or unexported fields
}

func MustNewPeriod

func MustNewPeriod(academicStartYear, academicEndYear int, semester Semester) Period

func NewPeriod

func NewPeriod(academicStartYear, academicEndYear int, semester Semester) (Period, error)

func (Period) AcademicEndYear

func (p Period) AcademicEndYear() int

func (Period) AcademicStartYear

func (p Period) AcademicStartYear() int

func (Period) IsZero

func (p Period) IsZero() bool

func (Period) Semester

func (p Period) Semester() Semester

func (Period) String

func (p Period) String() string

type Semester

type Semester uint8
const (
	FirstSemester Semester = iota + 1
	SecondSemester
)

func (Semester) IsValid

func (s Semester) IsValid() bool

func (Semester) String

func (s Semester) String() string

type Task

type Task struct {
	// contains filtered or unexported fields
}

func (*Task) Deadline

func (t *Task) Deadline() (Deadline, bool)

func (*Task) Description

func (t *Task) Description() string

func (*Task) Number

func (t *Task) Number() int

func (*Task) TestData

func (t *Task) TestData() ([]TestData, bool)

func (*Task) TestPoints

func (t *Task) TestPoints() ([]TestPoint, bool)

func (*Task) Title

func (t *Task) Title() string

func (*Task) Type

func (t *Task) Type() TaskType

type TaskType

type TaskType uint8
const (
	ManualCheckingType TaskType = iota + 1
	AutoCodeCheckingType
	TestingType
)

func (TaskType) IsValid

func (t TaskType) IsValid() bool

func (TaskType) String

func (t TaskType) String() string

type TestData

type TestData struct {
	// contains filtered or unexported fields
}

func MustNewTestData

func MustNewTestData(inputData, outputData string) TestData

func NewTestData

func NewTestData(inputData, outputData string) (TestData, error)

func (TestData) InputData

func (td TestData) InputData() string

func (TestData) IsZero

func (td TestData) IsZero() bool

func (TestData) OutputData

func (td TestData) OutputData() string

type TestPoint

type TestPoint struct {
	// contains filtered or unexported fields
}

func MustNewTestPoint

func MustNewTestPoint(description string, variants []string, correctVariantNumbers []int) TestPoint

func NewTestPoint

func NewTestPoint(description string, variants []string, correctVariantNumbers []int) (TestPoint, error)

func (TestPoint) CorrectVariantNumbers

func (tp TestPoint) CorrectVariantNumbers() []int

func (TestPoint) Description

func (tp TestPoint) Description() string

func (TestPoint) IsZero

func (tp TestPoint) IsZero() bool

func (TestPoint) Variants

func (tp TestPoint) Variants() []string

type TestingTaskCreationParams

type TestingTaskCreationParams struct {
	Title       string
	Description string
	TestPoints  []TestPoint
}

type UnmarshallingParams

type UnmarshallingParams struct {
	ID            string
	Title         string
	Period        Period
	Started       bool
	CreatorID     string
	Collaborators []string
	Students      []string
	Tasks         []UnmarshallingTaskParams
}

type UnmarshallingTaskParams

type UnmarshallingTaskParams struct {
	Number      int
	Title       string
	Description string
	TaskType    TaskType
	Deadline    Deadline
	TestPoints  []TestPoint
	TestData    []TestData
}

Jump to

Keyboard shortcuts

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