eventreporter

package module
v0.0.0-...-21c53e4 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2014 License: MIT Imports: 9 Imported by: 2

README

eventreporter

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadAndValidate

func LoadAndValidate(w http.ResponseWriter, r *http.Request, l Logger, dst interface{}) (ok bool)

func Shuffle

func Shuffle(data sort.Interface)

func WriteError

func WriteError(w http.ResponseWriter, l Logger, status int, err error) error

func WriteJson

func WriteJson(w http.ResponseWriter, i interface{}) error

Types

type ById

type ById struct {
	PlayerSlice
}

func (*ById) Less

func (a *ById) Less(i, j int) bool

type ByMatchPoints

type ByMatchPoints struct {
	MatchPoints map[Player]int
	PlayerSlice
}

func NewByMatchPoints

func NewByMatchPoints(event Event) ByMatchPoints

func (*ByMatchPoints) Less

func (a *ByMatchPoints) Less(i, j int) bool

type ByTieBreakers

type ByTieBreakers struct {
	MatchPoints   map[Player]int
	MatchWinRates map[Player]float64
	GameWinRates  map[Player]float64
	PlayerSlice
}

func NewByTieBreakers

func NewByTieBreakers(event Event) ByTieBreakers

func (*ByTieBreakers) Less

func (a *ByTieBreakers) Less(i, j int) bool

type Event

type Event struct {
	Rounds        []Round
	ActivePlayers map[Player]interface{}
	Title         string
	Active        bool
}

func NewEvent

func NewEvent() *Event

func (Event) FinalRankings

func (e Event) FinalRankings() []Player

func (Event) GameWinRates

func (e Event) GameWinRates() map[Player]float64

func (Event) GeneratePairings

func (e Event) GeneratePairings() Round

func (Event) MatchPoints

func (e Event) MatchPoints() map[Player]int

func (Event) MatchWinRates

func (e Event) MatchWinRates() map[Player]float64

type EventId

type EventId string

type Logger

type Logger interface {
	Errorf(fmt string, args ...interface{})
}

type Match

type Match struct {
	Player1  Player
	Player2  Player
	Table    int
	Record   Record
	Complete bool
}

func (Match) Points

func (m Match) Points(p Player) (int, error)

type MatchId

type MatchId string

type Player

type Player struct {
	Name string `checks:"NotEmpty"`
	Id   string `checks:"NotEmpty"`
}

type PlayerSlice

type PlayerSlice []Player

func (PlayerSlice) Len

func (a PlayerSlice) Len() int

func (PlayerSlice) Less

func (a PlayerSlice) Less(i, j int) bool

func (PlayerSlice) Swap

func (a PlayerSlice) Swap(i, j int)

type Record

type Record struct {
	Win  int
	Draw int
	Lose int
}

func (Record) GamesPlayed

func (r Record) GamesPlayed() int

type Round

type Round struct {
	Matches []Match
	Active  bool
}

func (*Round) Len

func (r *Round) Len() int

func (*Round) Less

func (r *Round) Less(i, j int) bool

func (*Round) Swap

func (r *Round) Swap(i, j int)

type RoundId

type RoundId string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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