controller

package
v0.0.0-...-bc49051 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// SessionKeyUser is the session state key where the user reference is held.
	SessionKeyUser = "User"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Home

type Home struct {
	apputil.BaseController

	Config config.Config
	Model  model.Manager
}

Home is the home controller.

func (Home) Register

func (h Home) Register(app *web.App)

Register regisers the controller.

type HomeViewModel

type HomeViewModel struct {
	TotalQuizzes            int
	TotalQuizResults        int
	TotalQuizResultsCorrect int
	TotalQuizDuration       time.Duration
	Quizzes                 []*types.Quiz
}

HomeViewModel is the viewmodel for the home page.

func CreateHomeViewModel

func CreateHomeViewModel(all []*types.Quiz) (hvm HomeViewModel)

CreateHomeViewModel creates a home view model.

func (HomeViewModel) TotalQuizCorrectPct

func (hvm HomeViewModel) TotalQuizCorrectPct() float64

TotalQuizCorrectPct returns the percentage of results correct.

type Index

type Index struct {
	apputil.BaseController

	Model  model.Manager
	Config config.Config
}

Index is the root controller.

func (Index) Register

func (i Index) Register(app *web.App)

Register regisers the controller.

type Quiz

type Quiz struct {
	apputil.BaseController

	Config config.Config
	Model  model.Manager
}

Quiz is the quiz controller.

func (Quiz) Register

func (q Quiz) Register(app *web.App)

Register adds the controller methods to the app.

Jump to

Keyboard shortcuts

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