scores

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AsErrNoRecord

func AsErrNoRecord(e error) bool

Types

type ErrNoRecord

type ErrNoRecord struct{}

func (*ErrNoRecord) Error

func (e *ErrNoRecord) Error() string

type PostgresService

type PostgresService struct {
	DB                     *sqlx.DB
	Logger                 *zap.Logger
	ScoresTableName        string
	ParticipationTableName string
	UserIGNTableName       string
}

func (*PostgresService) ClaimScore

func (ps *PostgresService) ClaimScore(
	pid string,
	score int,
	proof string,
) (submissionID string, e error)

func (*PostgresService) DeleteScore

func (ps *PostgresService) DeleteScore(sid string) error

func (*PostgresService) GetOneUnverified

func (ps *PostgresService) GetOneUnverified() (*ScoreRecord, error)

func (*PostgresService) GetOneUnverifiedForEvent

func (ps *PostgresService) GetOneUnverifiedForEvent(eid string) (*ScoreRecord, error)

func (*PostgresService) MakeReportScoreSum

func (ps *PostgresService) MakeReportScoreSum(eid string) ([]SummaryRecord, error)

func (*PostgresService) MakeReportScoreTop

func (ps *PostgresService) MakeReportScoreTop(eid string) ([]SummaryRecord, error)

func (*PostgresService) UpdateScoreAndVerify

func (ps *PostgresService) UpdateScoreAndVerify(sid string, score int) error

func (*PostgresService) VerificationStatus

func (ps *PostgresService) VerificationStatus(eid string) (total, verified int, e error)

func (*PostgresService) Verify

func (ps *PostgresService) Verify(sid string) error

type ScoreRecord

type ScoreRecord struct {
	ID       string `db:"eid"`
	PID      string `db:"pid"`
	UID      string `db:"uid"`
	IGN      string `db:"ign"`
	Score    int    `db:"score"`
	Proof    string `db:"proof"`
	Verified bool   `db:"verified"`
}

type ScoresService

type ScoresService interface {
	ClaimScore(pid string, score int, proof string) (submissionID string, e error)
	GetOneUnverified() (*ScoreRecord, error)
	GetOneUnverifiedForEvent(eid string) (*ScoreRecord, error)
	Verify(sid string) error
	MakeReportScoreSum(eid string) ([]SummaryRecord, error)
	MakeReportScoreTop(eid string) ([]SummaryRecord, error)
	VerificationStatus(eid string) (total, verified int, e error)
	DeleteScore(sid string) error
	UpdateScoreAndVerify(sid string, score int) error
}

type SummaryRecord

type SummaryRecord struct {
	UID   string `db:"uid"`
	IGN   string `db:"ign"`
	Score int    `db:"score"`
}

Jump to

Keyboard shortcuts

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