Documentation
¶
Index ¶
- Constants
- func AreValidLocales(locales []string) bool
- func DefaultLocale() string
- func IsValidLocale(locale string) bool
- func LocaleIcon(locale string) string
- func Locales() []string
- func UILocales() []string
- type CreateInterpretationArgs
- type CreateItemArgs
- type CreateQuestionArgs
- type CreateScaleArgs
- type CreateTagArgs
- type CreateTestArgs
- type CreateTestDisplayArgs
- type Event
- type GenerateQuestionsArgs
- type Interpretation
- type InterpretationTranslation
- type Item
- type ItemTranslation
- type Norm
- type NormCalculationData
- type PrepareTestArgs
- type QueryTestsArgs
- type Question
- type QuestionTranslation
- type Response
- type Result
- type Sample
- type SampleCriteria
- type Scale
- type ScaleResult
- type ScaleTranslation
- type SystemSummary
- type Tag
- type TagTranslation
- type Take
- type Test
- func (t *Test) CalculateDuration() time.Duration
- func (t *Test) CalculateMark() float64
- func (t *Test) CalculateResult(overrideMethod string) error
- func (t *Test) DefaultDuration() time.Duration
- func (t *Test) GetItem(code string) *Item
- func (t *Test) IsDone() bool
- func (t *Test) IsNotDone() bool
- func (t *Test) IsPageDone(page int) bool
- func (t *Test) IsPageNotDone(page int) bool
- func (t *Test) Link(domain string) string
- func (t *Test) LinkSafe(domain string) string
- func (t *Test) OrderQuestions(seed int64)
- func (t *Test) PageCount() int
- func (t *Test) QuestionsForPage(page int) []*Question
- func (t *Test) ResultShareText() string
- type TestDisplay
- type TestTranslation
- type User
- type UserSession
- type UserSummary
Constants ¶
View Source
const ( // env EnvDev = "dev" // locales LocaleRu = "ru" LocaleEn = "en" // generate questions methods GenerateQuestionsNone = "none" GenerateQuestionsEachItem = "each-item" // scale types ScaleTypeSten = "sten" ScaleTypeSum = "sum" ScaleTypePerc = "perc" ScaleTypeZScore = "zscore" ScaleTypeMean = "mean" // question types QuestionTypeSimple = "simple" // test steps TestStepIntro = "intro" TestStepQuestions = "questions" TestStepFinish = "finish" TestStepResult = "result" // samples SampleAllCode = "all" SampleAllNonSuspiciousCode = "all-not-suspicious" // norms NormMinBase = 10 NormOKBase = 50 NormGoodBase = 100 // take TakeMinTime = 8 * time.Second TakeMaxTime = 2 * time.Hour TakeMinMark = 1 TakeMaxMark = 5 // tags TagTypeTheme = "theme" TagTypeLen = "len" TagTypeFeature = "feature" TagCodeShort = "short" TagCodeMedium = "medium" TagCodeLong = "long" TagLenShort = 10 TagLenLong = 50 // time DefaultDisplayTime = time.RFC822 // app AppMaxEvents = 30 )
Variables ¶
This section is empty.
Functions ¶
func AreValidLocales ¶
func DefaultLocale ¶
func DefaultLocale() string
func IsValidLocale ¶
func LocaleIcon ¶
Types ¶
type CreateInterpretationArgs ¶
type CreateInterpretationArgs struct { Range [2]float64 Translations []InterpretationTranslation }
test import args
type CreateItemArgs ¶
type CreateItemArgs struct { Code string Steps int Reverse bool Translations []ItemTranslation }
test import args
type CreateQuestionArgs ¶
type CreateQuestionArgs struct { Code string Type string Order int Translations []QuestionTranslation Items []CreateItemArgs }
test import args
type CreateScaleArgs ¶
type CreateScaleArgs struct { Type string Code string Translations []ScaleTranslation Items []CreateItemArgs Interpretations []CreateInterpretationArgs }
test import args
type CreateTagArgs ¶
type CreateTagArgs struct { Code string Type string Translations []TagTranslation }
test import args
func (*CreateTagArgs) ValidateTranslations ¶
func (t *CreateTagArgs) ValidateTranslations() error
type CreateTestArgs ¶
type CreateTestArgs struct { Code string Published bool AvailableLocales []string `yaml:"availableLocales"` ForceUpdate bool `yaml:"forceUpdate"` Generate GenerateQuestionsArgs Image string Tags []string Translations []TestTranslation Questions []CreateQuestionArgs Scales []CreateScaleArgs Display CreateTestDisplayArgs }
test import args
func (*CreateTestArgs) ValidateTranslations ¶
func (t *CreateTestArgs) ValidateTranslations() error
type CreateTestDisplayArgs ¶
type CreateTestDisplayArgs struct { QuestionsPerPage int `yaml:"questionsPerPage"` RandomizeOrder bool `yaml:"randomizeOrder"` }
test import args
type GenerateQuestionsArgs ¶
type GenerateQuestionsArgs struct { Method string Template CreateQuestionArgs }
test import args
type Interpretation ¶
test logic types
type InterpretationTranslation ¶
test import args
type Item ¶
type Item struct { ID uuid.UUID TestID uuid.UUID ScaleID uuid.UUID QuestionID uuid.UUID Code string Content string // translatable Steps int // number of steps in response scale Reverse bool // Type string Response *Response // for use in handler, not for saving }
test logic types
func (*Item) AddResponse ¶
func (*Item) CurrentResponseValue ¶
type ItemTranslation ¶
test import args
type Norm ¶
type Norm struct { ID uuid.UUID SampleID uuid.UUID ScaleID uuid.UUID Name string Base int Mean float64 Sigma float64 Rank int Meta map[string]interface{} }
test logic types
type NormCalculationData ¶
norm calculation args
type PrepareTestArgs ¶
function args
type QueryTestsArgs ¶
query args
type Question ¶
type Question struct { ID uuid.UUID TestID uuid.UUID Code string Order int Content string // translatable HeaderContent string // translatable Items []*Item }
test logic types
type QuestionTranslation ¶
test import args
type Response ¶
type Response struct { ID uuid.UUID ItemID uuid.UUID TakeID uuid.UUID Value int CreateTime time.Time UpdateTime time.Time Meta map[string]interface{} }
test logic types
type Result ¶
type Result struct { ID uuid.UUID TakeID uuid.UUID ScaleID uuid.UUID RawScore float64 FinalScore float64 CreateTime time.Time UpdateTime time.Time Meta map[string]interface{} }
Result is saved to db and used for norms calculation there's no need as yet to save calculatable data like min, max, etc.
type Sample ¶
type Sample struct { ID uuid.UUID Code string Criteria SampleCriteria }
test logic types
type SampleCriteria ¶
type SampleCriteria struct { NotSuspicious bool `json:"notSuspicious,omitempty"` Locale string `json:"locale,omitempty"` }
test logic types
type Scale ¶
type Scale struct { ID uuid.UUID Code string Type string Title string // translatable Description string // translatable Abbreviation string // translatable Global bool // if scale can be used by more than one test Items []*Item Interpretations []*Interpretation Result *ScaleResult // not save in db as yet Norm *Norm // to use in calculation }
test logic types
func (*Scale) CalculateResult ¶
func (*Scale) ResultShareText ¶
type ScaleResult ¶
type ScaleResult struct { RawScore float64 Score float64 Min float64 Max float64 Interpretation *Interpretation Formula string Elapsed time.Duration Unit string Meta map[string]interface{} }
test logic types
type ScaleTranslation ¶
test import args
type SystemSummary ¶
type SystemSummary struct { ID int Users int Tests int FinishedTakes int Responses int CreateTime time.Time }
system types
type Take ¶
type Take struct { ID uuid.UUID UserID uuid.UUID TestID uuid.UUID Seed int64 StartTime *time.Time EndTime *time.Time Suspicious bool InLocale string CreateTime time.Time UpdateTime time.Time Page int Status string Progress int Mark *int Meta map[string]interface{} }
Take is one instance of user taking a test
type Test ¶
type Test struct { ID uuid.UUID Code string // unique code for url Title string // translatable Description string // translatable Details template.HTML // translatable Instruction template.HTML // translatable ResultPreambule template.HTML // translatable Locale string AvailableLocales []string GenerateQuestions string Published bool Questions []*Question Scales []*Scale Tags []*Tag Image string Display TestDisplay Mark float64 Duration time.Duration QuestionCount int // for display (and less joins in requests) Take *Take // for use in handler Takes []*Take // for calculations }
test logic types
func (*Test) CalculateDuration ¶
func (*Test) CalculateMark ¶
func (*Test) CalculateResult ¶
func (*Test) DefaultDuration ¶
func (*Test) IsPageDone ¶
func (*Test) IsPageNotDone ¶
func (*Test) OrderQuestions ¶
func (*Test) QuestionsForPage ¶
func (*Test) ResultShareText ¶
type TestDisplay ¶
test logic types
type TestTranslation ¶
type TestTranslation struct { Locale string Title string Description string Details string Instruction string Preambule string }
test import args
type User ¶
type User struct { ID uuid.UUID Name string Email string Admin bool Picture string Password string PasswordHash string Locale string Anonymous bool UseDarkTheme bool AnonymousID []uuid.UUID Meta map[string]interface{} }
user types
type UserSession ¶
type UserSession struct { ID int // probably uuid not needed here, sessions are temporary anyways SID string // code to identify the session UserID uuid.UUID IP string UserAgent string CreateTime time.Time UpdateTime time.Time LastActivity time.Time Meta map[string]interface{} Active bool }
user types
Click to show internal directories.
Click to hide internal directories.