faceoff

package module
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2018 License: MIT Imports: 13 Imported by: 0

README

faceoff

faceoff is a small web app to decide what is better through an elemination tournament in one-against-one decision votings.

A live demo can be seen at whatisbetter.de (currently only in german, sorry)

This is more than anything else a little project to get hands on experience with different technologies/concepts:

  • go on server side
  • go on client side (through gopherjs)
  • Single Page Applications (SPA)
    • Client side routing
    • HTML5 history API
    • Client side data storage/processing
    • Client side template rendering
  • Websockets
  • Simple Key/Value DB (bbolt) instead of full SQL DBMS
  • nginx as a reverse proxy with TLS (not part of this repository)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Contender

type Contender int
const (
	A    Contender = 0
	B    Contender = 1
	NONE Contender = -1
)

type ContestDescription added in v0.4.0

type ContestDescription struct {
	Key  string
	Name string
}

type ContestList added in v0.4.0

type ContestList struct {
	Open   []ContestDescription
	Closed []ContestDescription
}

type Match

type Match struct {
	Contenders [2]string
	Score      [2]int
	Winner     Contender
	Num        int
}

func NewMatch

func NewMatch(contenderA string, contenderB string) *Match

func (*Match) WinA

func (m *Match) WinA()

func (*Match) WinB

func (m *Match) WinB()

type Roster

type Roster struct {
	UUID         []byte
	Rounds       []*Round
	CurrentVotes int
	ActiveRound  int
	Name         string
}

func CreateRoster

func CreateRoster(name string, participants []string) (*Roster, error)

func CreateRosterRaw

func CreateRosterRaw(name string, participants []byte) (*Roster, error)

func ParseRoster

func ParseRoster(r io.ReadCloser) (*Roster, error)

func (*Roster) AddVotes

func (r *Roster) AddVotes(vote *Roster)

func (*Roster) AdvanceRound

func (r *Roster) AdvanceRound()

func (*Roster) DeepCopy

func (r *Roster) DeepCopy() *Roster

type Round

type Round struct {
	Matches []*Match
}

type TemplateSet

type TemplateSet struct {
	Templates map[string]string
}

func LoadTemplatesFromDisk

func LoadTemplatesFromDisk() (*TemplateSet, error)

func LoadTemplatesFromGob

func LoadTemplatesFromGob(b []byte) (*TemplateSet, error)

func (*TemplateSet) EncodeGob

func (ts *TemplateSet) EncodeGob() ([]byte, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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