Documentation
¶
Index ¶
- Constants
- Variables
- type Aspect
- type AspectDescription
- type AspectInfo
- type Aspects
- func (aspects *Aspects) Add(other *Aspects)
- func (aspects *Aspects) ClearComments()
- func (aspects *Aspects) Comment(name string) string
- func (aspects *Aspects) EnsureRange()
- func (aspects *Aspects) Scale(multiplier float64)
- func (aspects *Aspects) Score(name string) float64
- func (aspects *Aspects) Total() float64
- func (aspects *Aspects) UpdateTotal()
- type AspectsInfo
- type Ballot
- type BallotInfo
- type BallotRepo
- type Context
- type DB
- type Event
- func (event *Event) AddRemoveJammers(added, removed []user.UserID)
- func (event *Event) AddRemoveJudges(added, removed []user.UserID)
- func (event *Event) CanRegister(u *user.User) bool
- func (event *Event) CanVote() bool
- func (event *Event) HasJammer(u *user.User) bool
- func (event *Event) HasJudge(u *user.User) bool
- func (event *Event) HasJudgeById(userId *user.UserID) bool
- func (event *Event) JudgesExist() bool
- func (event *Event) Less(other *Event) bool
- func (event *Event) Path(subroutes ...any) string
- type EventID
- type EventTeam
- type Game
- type Member
- type Range
- type Repo
- type Server
- func (server *Server) BallotsCSV(context *Context)
- func (server *Server) Context(w http.ResponseWriter, r *http.Request) *Context
- func (server *Server) CreateEvent(context *Context)
- func (server *Server) CreateTeam(context *Context)
- func (server *Server) Dashboard(context *Context)
- func (server *Server) DeleteTeam(context *Context)
- func (server *Server) EditEvent(context *Context)
- func (server *Server) EditTeam(context *Context)
- func (server *Server) FillQueue(context *Context)
- func (server *Server) Handler(fn func(*Context)) http.HandlerFunc
- func (server *Server) HandlerMaybe(fn func(*Context)) http.HandlerFunc
- func (server *Server) Jammers(context *Context)
- func (server *Server) Linking(context *Context)
- func (server *Server) LinkingApproveAll(context *Context)
- func (server *Server) List(context *Context)
- func (server *Server) Progress(context *Context)
- func (server *Server) Register(router *http.ServeMux)
- func (server *Server) Results(context *Context)
- func (server *Server) Reveal(context *Context)
- func (server *Server) Team(context *Context)
- func (server *Server) Teams(context *Context)
- func (server *Server) Vote(context *Context)
- func (server *Server) Voting(context *Context)
- type Team
- func (team *Team) HasEditor(user *user.User) bool
- func (team *Team) HasMember(user *user.User) bool
- func (team *Team) HasMemberID(userid user.UserID) bool
- func (team *Team) HasSubmitted() bool
- func (team *Team) IsCompeting() bool
- func (team *Team) Less(other *Team) bool
- func (team *Team) MembersForEdit(isAdmin bool) []Member
- func (team *Team) MembersWithEmpty() []Member
- func (team *Team) Verify() error
- type TeamID
- type TeamRepo
- type TeamResult
Constants ¶
const MaxTeamMembers = 9
MaxTeamMembers defines hard limit on team members.
const SuggestedTeamMembers = 6
SuggestedTeamMemberes defines how many members are shown by default.
Variables ¶
var AspectDescriptions = []AspectDescription{ { Name: "Theme", Description: "How well does it interpret the theme?", Range: Range{Min: 1, Max: 5, Step: 0.1}, Options: []string{"Not even close", "Resembling", "Related", "Spot on", "Novel Interpretation"}, }, { Name: "Enjoyment", Description: "How does the game generally feel?", Range: Range{Min: 1, Max: 5, Step: 0.1}, Options: []string{"I want my time back", "Boring", "Nice", "Didn't want to stop", "Will play later"}, }, { Name: "Aesthetics", Description: "How well is the story, art and audio executed?", Range: Range{Min: 1, Max: 5, Step: 0.1}, Options: []string{"None", "Needs tweaks", "Nice", "Really good", "Exceptional"}, }, { Name: "Innovation", Description: "Something novel in the game?", Range: Range{Min: 1, Max: 5, Step: 0.1}, Options: []string{"Seen it a lot", "Interesting variation", "Interesting approach", "Never seen this before", "Exceptional"}, }, { Name: "Bonus", Description: "Anything exceptionally special about it?", Range: Range{Min: 0, Max: 2.5, Step: 0.1}, Options: []string{"Nothing special", "Really liked *", "Really loved **"}, }, }
AspectDescriptions contains information about aspects.
var AspectDescriptionsWithOverall = append(AspectDescriptions, AspectDescription{ Name: "Overall", Description: "Weighted average of topics.", Range: Range{Min: 1, Max: 5, Step: 0.1}, })
AspectDescriptionsWithOverall also includes the overall.
var AspectNames = []string{
"Theme",
"Enjoyment",
"Aesthetics",
"Innovation",
"Bonus",
"Overall",
}
AspectNames contains all names of aspects.
var DefaultAspects = Aspects{ Theme: Aspect{3, ""}, Enjoyment: Aspect{3, ""}, Aesthetics: Aspect{3, ""}, Innovation: Aspect{3, ""}, Bonus: Aspect{0, ""}, Overall: Aspect{0, ""}, }
DefaultAspects contains defaults for aspects.
var ErrExists = errors.New("already exists")
ErrExists is returned when an event already exists.
var ErrNotExists = errors.New("does not exist")
ErrNotExists is returned when an event doesn't exist.
Functions ¶
This section is empty.
Types ¶
type AspectDescription ¶
AspectDescription describes an aspect.
type AspectInfo ¶
AspectInfo contains all scores for an aspect.
func (*AspectInfo) Add ¶
func (aspect *AspectInfo) Add(other *Aspect, isMember bool)
Add includes other into aspect.
type Aspects ¶
type Aspects struct {
Theme Aspect
Enjoyment Aspect
Aesthetics Aspect
Innovation Aspect
Bonus Aspect
Overall Aspect
}
Aspects contains criteria for scoring a game.
func AverageScores ¶
AverageScores returns averages for all aspects.
func (*Aspects) ClearComments ¶
func (aspects *Aspects) ClearComments()
ClearComments clears all comments in aspects.
func (*Aspects) EnsureRange ¶
func (aspects *Aspects) EnsureRange()
EnsureRange ensures that all scores are in the appropriate ranges.
func (*Aspects) UpdateTotal ¶
func (aspects *Aspects) UpdateTotal()
UpdateTotal updates overall score.
type AspectsInfo ¶
type AspectsInfo struct {
Theme AspectInfo
Enjoyment AspectInfo
Aesthetics AspectInfo
Innovation AspectInfo
Bonus AspectInfo
Overall AspectInfo
}
AspectsInfo contains all scores for aspects.
func (*AspectsInfo) Add ¶
func (aspects *AspectsInfo) Add(other *Aspects, isMember bool)
Add includes other into aspects.
func (*AspectsInfo) Item ¶
func (aspects *AspectsInfo) Item(name string) AspectInfo
Item fetches an aspect by name.
type Ballot ¶
type Ballot struct {
ID *datastore.Key `datastore:"-"`
Voter user.UserID
Team TeamID
Index int64 `datastore:",noindex"`
Completed bool `datastore:",noindex"`
Aspects
}
Ballot is all information for a single ballot.
type BallotInfo ¶
BallotInfo is a single ballot, but contains a reference to the target team.
type BallotRepo ¶
type BallotRepo interface {
Ballots(eventid EventID) ([]*Ballot, error)
CreateIncompleteBallots(eventid EventID, userid user.UserID) (complete, incomplete []*BallotInfo, err error)
SubmitBallot(eventid EventID, ballot *Ballot) error
UserBallot(eventid EventID, userid user.UserID, teamid TeamID) (*Ballot, error)
UserBallots(eventid EventID, userid user.UserID) ([]*BallotInfo, error)
Results(eventid EventID) ([]*TeamResult, error)
TeamBallots(eventid EventID, teamid TeamID) ([]*Ballot, error)
}
BallotRepo is used to manage ballots for an event.
type Event ¶
type Event struct {
ID EventID `datastore:"-"`
Name string
Theme string `datastore:",noindex"`
Info string `datastore:",noindex"`
// Created is the time when the event was created
Created time.Time `datastore:",noindex"`
// StartTime is the starting time of the event
StartTime time.Time `datastore:",noindex"`
// EndTime is the end time of the event
EndTime time.Time `datastore:",noindex"`
JudgePercentage float64 `datastore:",noindex"`
// New Registration is allowed
Registration bool `datastore:",noindex"`
// Voting allow voting
Voting bool `datastore:",noindex"`
// Closed for new entries
Closed bool `datastore:",noindex"`
// Revealed, results are publicly viewable
Revealed bool `datastore:",noindex"`
VotingOpens time.Time `datastore:",noindex"`
VotingCloses time.Time `datastore:",noindex"`
Organizers []user.UserID `datastore:",noindex"`
Jammers []user.UserID `datastore:",noindex"`
Judges []user.UserID `datastore:",noindex"`
}
Event contains all information about an event.
func (*Event) AddRemoveJammers ¶
AddRemoveJammers adds and removes jammers from the event.
func (*Event) AddRemoveJudges ¶
AddRemoveJudges adds and removes judges from the event.
func (*Event) CanRegister ¶
CanRegister returns whether u can register to the event.
func (*Event) JudgesExist ¶
type Game ¶
type Game struct {
Name string
Info string `datastore:",noindex"`
Noncompeting bool `datastore:",noindex"`
Link struct {
Jam string `datastore:",noindex"`
Download string `datastore:",noindex"`
Facebook string `datastore:",noindex"`
} `datastore:",noindex"`
}
Game contains all information about a game.
type Repo ¶
type Repo interface {
List() ([]*Event, error)
Create(event *Event) error
ByID(id EventID) (*Event, error)
Update(event *Event) error
TeamRepo
BallotRepo
}
Repo describes interaction with the database.
type Server ¶
Server handles pages related to an event.
func (*Server) BallotsCSV ¶
BallotsCSV returns all ballots for analysis.
func (*Server) CreateEvent ¶
CreateEvent handles page for creating a new event.
func (*Server) CreateTeam ¶
CreateTeam handles page for creating a new team.
func (*Server) DeleteTeam ¶
DeleteTeam handles page for deleting a team.
func (*Server) Handler ¶
func (server *Server) Handler(fn func(*Context)) http.HandlerFunc
Handler wraps fn with Context, however a valid event id is required.
func (*Server) HandlerMaybe ¶
func (server *Server) HandlerMaybe(fn func(*Context)) http.HandlerFunc
HandlerMaybe wraps fn with automatic Context creation.
func (*Server) Linking ¶
Linking displays information about users who have not been linked to their users.
func (*Server) LinkingApproveAll ¶
LinkingApproveAll tries to associate all team members with appropriate teams and users.
type Team ¶
type Team struct {
EventID EventID `datastore:"-"`
ID TeamID `datastore:"-"`
Name string
Members []Member
Game Game `datastore:",noindex"`
}
Team contains all information about a team.
func (*Team) HasMemberID ¶
HasMemberID checks whether user is a member by userid.
func (*Team) HasSubmitted ¶
HasSubmitted checks whether team has all information necessary.
func (*Team) IsCompeting ¶
IsCompeting returns whether team is part of the prizes.
func (*Team) MembersForEdit ¶
MembersForEdit returns slice with additional empty members if needed.
func (*Team) MembersWithEmpty ¶
MembersWithEmpty returns slice with additional empty members if needed.
type TeamRepo ¶
type TeamRepo interface {
CreateTeam(id EventID, team *Team) (TeamID, error)
UpdateTeam(id EventID, team *Team) error
DeleteTeam(id EventID, teamid TeamID) error
TeamByID(id EventID, teamid TeamID) (*Team, error)
Teams(id EventID) ([]*Team, error)
TeamsByUser(id user.UserID) ([]*EventTeam, error)
}
TeamRepo contains team management in an event.
type TeamResult ¶
type TeamResult struct {
*Team
Ballots []*Ballot
Average Aspects
JudgeAverage Aspects
JammerAverage Aspects
Pending int
Complete int
MemberBallots []*Ballot
}
TeamResult contains all information about a single teams result.
func (*TeamResult) HasReviewer ¶
func (info *TeamResult) HasReviewer(userid user.UserID) bool
HasReviewer checks whether team results contains userid.