challenge

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: May 3, 2024 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Answer

type Answer struct {
	Name           string     `toml:"name"`
	Text           string     `toml:"text" validate:"required"`
	CodeLineRanges LineRanges `toml:"code_line_ranges" validate:"line_ranges"`
}

func (Answer) IsRight

func (a Answer) IsRight(line int) bool

func (Answer) IsWrong

func (a Answer) IsWrong() bool

type Challenge

type Challenge struct {
	Name               string       `toml:"name" validate:"required"`
	Category           TaskCategory `toml:"category" validate:"required,oneof=beginner easy concurrency performance wtf"`
	DefaultCodeSnippet string       `toml:"default_code_snippet" validate:"required"`
	Questions          []Question   `toml:"questions" validate:"required,dive"`
	LearningAdvise     string       `toml:"learning_advise" validate:"required"`
	LearningLinks      []Link       `toml:"learning_links" validate:"dive"`
}

func LoadAll

func LoadAll() (tasks []Challenge, err error)

type LineRanges

type LineRanges [][]int

func (LineRanges) In

func (r LineRanges) In(line int) bool
type Link struct {
	Title string `toml:"title" validate:"required"`
	URL   string `toml:"url" validate:"required"`
}

type Question

type Question struct {
	Text    string       `toml:"text" validate:"required"`
	Type    QuestionType `toml:"type" validate:"required,oneof=select_answers code_writing"`
	Answers []Answer     `toml:"answers" validate:"required,dive"`
}

func (Question) RightAnswers added in v0.2.0

func (q Question) RightAnswers() (count int, hasLines bool)

type QuestionType

type QuestionType string
const (
	SelectAnswers QuestionType = "select_answers"
	WriteCode     QuestionType = "code_writing"
)

type TaskCategory

type TaskCategory string
const (
	Beginner    TaskCategory = "beginner"
	Easy        TaskCategory = "easy"
	Concurrency TaskCategory = "concurrency"
	Performance TaskCategory = "performance"
	WTF         TaskCategory = "wtf"
)

Jump to

Keyboard shortcuts

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