trivial

package
v0.0.0-...-8b20b1e Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2024 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GroupsStrategyAutoGrKind   = "GroupsStrategyAuto"
	GroupsStrategyManualGrKind = "GroupsStrategyManual"
)

Variables

View Source
var (
	WarningLogger  = log.New(os.Stdout, "tv-store:ERROR:", 0)
	ProgressLogger = log.New(os.Stdout, "tv-store:INFO:", 0)
)

Functions

func CommonTags

func CommonTags(tags [][]ed.TagSection) ed.Tags

CommonTags returns the tags found in every list.

func LoadQuestionNumbers

func LoadQuestionNumbers(db tr.DB, config tr.Trivial, userID uID) (out [trivial.NbCategories]int, err error)

LoadQuestionNumbers returns the number of questions available for each categories, as defined by [config.Questions]

Types

type CheckMissingQuestionsOut

type CheckMissingQuestionsOut struct {
	Pattern editor.Tags   // empty if no pattern is found
	Missing []editor.Tags // missing tags, may be empty if OK
}

type Controller

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

Controller is the top level (singleton) objects handling requests related to trivial pousuit setups It delegates to trivial-poursuit.GameController for the actual game logic handling.

func NewController

func NewController(db *sql.DB, key pass.Encrypter, demoPin string, admin teacher.Teacher) *Controller

func (*Controller) CheckDemoQuestions

func (ct *Controller) CheckDemoQuestions() error

CheckDemoQuestions checks that the categories registred for the demo games indeed contains questions.

func (*Controller) CheckMissingQuestions

func (ct *Controller) CheckMissingQuestions(c echo.Context) error

CheckMissingQuestions is an hint to avoid forgetting a tag when setting up the questions. It first finds the current common tags, and then checks that no questions sharing the same tags are left behind.

func (*Controller) ConnectStudentSession

func (ct *Controller) ConnectStudentSession(c echo.Context) error

ConnectStudentSession handles the connection of one student to the activity, using the meta data returned by a previous call to `SetupStudentClient`.

func (*Controller) CreateTrivialPoursuit

func (ct *Controller) CreateTrivialPoursuit(c echo.Context) error

func (*Controller) DeleteTrivialPoursuit

func (ct *Controller) DeleteTrivialPoursuit(c echo.Context) error

func (*Controller) DuplicateTrivialPoursuit

func (ct *Controller) DuplicateTrivialPoursuit(c echo.Context) error

func (*Controller) GetTrivialPoursuit

func (ct *Controller) GetTrivialPoursuit(c echo.Context) error

func (*Controller) GetTrivialRunningSessions

func (ct *Controller) GetTrivialRunningSessions(c echo.Context) error

func (*Controller) GetTrivialsMetrics

func (ct *Controller) GetTrivialsMetrics(c echo.Context) error

GetTrivialsMetrics shows the number of actually running IsyTriv. This is a public endpoint.

func (*Controller) LaunchSessionTrivialPoursuit

func (ct *Controller) LaunchSessionTrivialPoursuit(c echo.Context) error

LaunchSessionTrivialPoursuit starts a new TrivialPoursuit session where the games are setup with the given config.

func (*Controller) SetupStudentClient

func (ct *Controller) SetupStudentClient(c echo.Context) error

SetupStudentClient handles the connection of one student to the activity It is responsible for checking the credentials, creating games if needed, and returning the resolved game URL param used by `ConnectStudentSession`.

func (*Controller) StartTrivialGame

func (ct *Controller) StartTrivialGame(c echo.Context) error

StartTtrivialGame starts a game created in manual mode

func (*Controller) StopTrivialGame

func (ct *Controller) StopTrivialGame(c echo.Context) error

StopTrivialGame stops a game, optionnaly restarting it, interrupting the connection with clients.

func (*Controller) StudentGetSelfaccess

func (ct *Controller) StudentGetSelfaccess(c echo.Context) error

func (*Controller) StudentLaunchSelfaccess

func (ct *Controller) StudentLaunchSelfaccess(c echo.Context) error

StudentLaunchSelfaccess creates a game for the given config, and returns the public game code, which may be joined with the regular API.

func (*Controller) StudentStartSelfaccess

func (ct *Controller) StudentStartSelfaccess(c echo.Context) error

StartSelfaccess starts a game previously created by [StudentLaunchSelfaccess] TODO: secure this access

func (*Controller) TrivialGetSelfaccess

func (ct *Controller) TrivialGetSelfaccess(c echo.Context) error

[TrivialGetSelfaccess] returns the classroom which may launch the given trivial

func (*Controller) TrivialTeacherMonitor

func (ct *Controller) TrivialTeacherMonitor(c echo.Context) error

TrivialTeacherMonitor returns the summary of games currently playing

func (*Controller) TrivialUpdateSelfaccess

func (ct *Controller) TrivialUpdateSelfaccess(c echo.Context) error

[TrivialUpdateSelfaccess] sets the classroom which may launch the given trivial

func (*Controller) UpdateTrivialPoursuit

func (ct *Controller) UpdateTrivialPoursuit(c echo.Context) error

func (*Controller) UpdateTrivialVisiblity

func (ct *Controller) UpdateTrivialVisiblity(c echo.Context) error

type GamePlayers

type GamePlayers struct {
	Player    string
	Successes tv.Success
}

type GameSummary

type GameSummary struct {
	GameID             tv.RoomID
	CurrentPlayer      string          // empty when no one is playing
	LatestQuestion     QuestionContent // empty before the first question
	Players            []GamePlayers
	RoomSize           tv.RoomSize
	InQuestionStudents []string
}

type GetSelfaccessOut

type GetSelfaccessOut struct {
	Trivials []trivial.Trivial
}

type GroupsStrategy

type GroupsStrategy interface {
	// contains filtered or unexported methods
}

type GroupsStrategyAuto

type GroupsStrategyAuto struct {
	Groups []int
}

GroupsStrategyAuto starts the game when full

type GroupsStrategyManual

type GroupsStrategyManual struct {
	NbGroups int
}

GroupsStrategyManual does not fix the number of players

type GroupsStrategyWrapper

type GroupsStrategyWrapper struct {
	Data GroupsStrategy
}

GroupsStrategyWrapper may be used as replacements for GroupsStrategy when working with JSON

func (GroupsStrategyWrapper) MarshalJSON

func (item GroupsStrategyWrapper) MarshalJSON() ([]byte, error)

func (*GroupsStrategyWrapper) UnmarshalJSON

func (out *GroupsStrategyWrapper) UnmarshalJSON(src []byte) error

type LaunchSelfaccessOut

type LaunchSelfaccessOut struct {
	GameID       tv.RoomID
	Notification events.EventNotification // new in version 1.7
}

type LaunchSessionIn

type LaunchSessionIn struct {
	IdConfig tr.IdTrivial

	Groups GroupsStrategy
}

func (LaunchSessionIn) MarshalJSON

func (item LaunchSessionIn) MarshalJSON() ([]byte, error)

func (*LaunchSessionIn) UnmarshalJSON

func (item *LaunchSessionIn) UnmarshalJSON(src []byte) error

type LaunchSessionOut

type LaunchSessionOut struct {
	GameIDs []trivial.RoomID
}

type MonitorOut

type MonitorOut struct {
	Games []GameSummary
}

type QuestionContent

type QuestionContent struct {
	Id        editor.IdQuestion `gomacro-opaque:"dart"` // 0 if empty
	Categorie tv.Categorie

	Question client.Question `gomacro-opaque:"typescript"`
	Params   tasks.Params    `gomacro-opaque:"typescript"`
}

type RunningSessionMetaOut

type RunningSessionMetaOut struct {
	NbGames int
}

type SetupStudentClientOut

type SetupStudentClientOut struct {
	GameMeta string
}

type TrivialExt

type TrivialExt struct {
	Config tr.Trivial
	Origin tcAPI.Origin

	NbQuestionsByCategories [trivial.NbCategories]int
	// Levels stores the Level tags for this trivial,
	// usually with length one.
	Levels []string
}

type TrivialSelfaccess

type TrivialSelfaccess struct {
	Classrooms []teacher.Classroom
	Actives    []teacher.IdClassroom
}

type UpdateSelfaccessIn

type UpdateSelfaccessIn struct {
	IdTrivial    trivial.IdTrivial
	IdClassrooms []teacher.IdClassroom
}

type UpdateTrivialVisiblityIn

type UpdateTrivialVisiblityIn struct {
	ConfigID tc.IdTrivial
	Public   bool
}

Jump to

Keyboard shortcuts

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