models

package
v0.0.0-...-c486c1d Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2025 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddOverallPlacement

func AddOverallPlacement(results []CompetitionResult)

func AddPlacementToCompetitionResults

func AddPlacementToCompetitionResults(results []CompetitionResult, format string)

func AddRecordsToHistory

func AddRecordsToHistory(
	history *ProfileTypeResultHistory,
	recorders Recorders,
	uid int,
	p *ProfileType,
)

func CompareCompetitionResults

func CompareCompetitionResults(res1 CompetitionResult, res2 CompetitionResult, format string) int

compares competition results by format returns: 0 - tie

< 0 - first is smaller
> 0 - second is smaller

func ComputeBests

func ComputeBests(bests map[int]BestEntry, rows []KinchQueryRow) error

func ComputePlacementForCompetition

func ComputePlacementForCompetition(
	rows *[]EventResultsRow,
	firstRowIdx int,
	lastRowIdx int,
	uid int,
	eventFormat string,
	db *pgxpool.Pool,
) (string, error)

func GenerateImagesForScrambles

func GenerateImagesForScrambles(scrambles []string, scramblingcode string, ismbld bool, envMap map[string]string) ([]string, error)

func GenerateScramblesForEvent

func GenerateScramblesForEvent(scramblingcode string, noOfSolves int, ismbld bool, envMap map[string]string) ([]string, error)

func GetCompletedSolves

func GetCompletedSolves(db *pgxpool.Pool, uid int) (int, error)

func GetEmailByWCAID

func GetEmailByWCAID(db *pgxpool.Pool, wcaid string) (string, error)

func GetFormattedTimes

func GetFormattedTimes(times []string, format string, scrambles []string) ([]string, error)

func GetNoOfCompetitions

func GetNoOfCompetitions(db *pgxpool.Pool, uid int) (int, error)

func GetScrambles

func GetScrambles(scramblingcode string, noOfSolves int, envMap map[string]string) ([]string, error)

func GetUserByName

func GetUserByName(db *pgxpool.Pool, name string) (int, error)

func GetUserByWCAID

func GetUserByWCAID(db *pgxpool.Pool, wcaid string) (int, error)

func GetUsersByCountryWithKinchScore

func GetUsersByCountryWithKinchScore(
	db *pgxpool.Pool,
) (map[string][]MapDataUser, string, string, error)

returns: map of OveralResults by country, logMsg, retMsg, error

func IsRecorder

func IsRecorder(recordersEntry *RecordersEntry, uid int, records *int)

func IsRecorder2

func IsRecorder2(recorders []int, uid int, records *int)

func IsRecorder3

func IsRecorder3(recorders []int, uid int) bool

func LoadBestSingleAndAverage

func LoadBestSingleAndAverage(
	db *pgxpool.Pool,
	resultEntries *[]ResultEntry,
	ismbld bool,
) (string, string, error)

func ProcessRecorders

func ProcessRecorders(recorders map[time.Time]RecordersEntry, uid int, ismbld bool) int

func ProcessResultEntryToLoadRank

func ProcessResultEntryToLoadRank(
	eventResultsRow *EventResultsRow,
	db *pgxpool.Pool,
	user *User,
	results map[int]ResultsSingleAverageEntry,
	ismbld bool,
) error

func UpdateAnnouncementTags

func UpdateAnnouncementTags(announcement *AnnouncementState, db *pgxpool.Pool, tx pgx.Tx, envMap map[string]string) error

func UpdateCompetitionEvents

func UpdateCompetitionEvents(competition *CompetitionData, db *pgxpool.Pool, tx pgx.Tx, envMap map[string]string) error

func UpdateRecordersByDate

func UpdateRecordersByDate(
	recorders map[time.Time]RecordersEntry,
	date time.Time,
	singleMili int,
	averageMili int,
	ismbld bool,
	uid int,
)

func UpdateRecordersEntry

func UpdateRecordersEntry(
	oldRecordersEntry *RecordersEntry,
	newRecordersEntry RecordersEntry,
	uid int,
	records *int,
	ismbld bool,
)

Types

type AdminStatsCollection

type AdminStatsCollection struct {
	Max       int     `json:"max"`
	Total     int     `json:"total"`
	Median    float64 `json:"median"`
	Average   float64 `json:"average"`
	ChartData struct {
		ColumnNames []string   `json:"columnNames"`
		Data        [][]string `json:"data"`
	} `json:"chartData"`
}

type AnnouncementState

type AnnouncementState struct {
	Id             int            `json:"id"`
	Title          string         `json:"title"`
	Content        string         `json:"content"`
	AuthorId       int            `json:"authorId"`
	AuthorWcaId    string         `json:"authorWcaId"`
	AuthorUsername string         `json:"authorUsername"`
	Tags           []Tag          `json:"tags"`
	Read           bool           `json:"read"`
	EmojiCounters  []EmojiCounter `json:"emojiCounters"`
}

func (*AnnouncementState) AddTags

func (a *AnnouncementState) AddTags(tx pgx.Tx, tag_ids []int) error

func (*AnnouncementState) Create

func (a *AnnouncementState) Create(db *pgxpool.Pool, envMap map[string]string) (string, string)

func (*AnnouncementState) GetEmojiCounters

func (a *AnnouncementState) GetEmojiCounters(db *pgxpool.Pool) error

func (*AnnouncementState) GetTags

func (a *AnnouncementState) GetTags(db *pgxpool.Pool) error

func (*AnnouncementState) IsRead

func (a *AnnouncementState) IsRead(db *pgxpool.Pool) error

func (*AnnouncementState) MakeAnnouncementUnreadForEveryone

func (a *AnnouncementState) MakeAnnouncementUnreadForEveryone(tx pgx.Tx) (string, string)

func (*AnnouncementState) MarkRead

func (a *AnnouncementState) MarkRead(db *pgxpool.Pool) error

func (*AnnouncementState) RemoveAllTags

func (a *AnnouncementState) RemoveAllTags(db *pgxpool.Pool, tx pgx.Tx) ([]int, error)

type AuthDetails

type AuthDetails struct {
	UserId    int   `json:"userid"`
	ExpiresIn int64 `json:"expiresin"`
}

func ExtractPayload

func ExtractPayload(tokenString *jwt.Token) (AuthDetails, error)

func GetAuthDetailsFromHeader

func GetAuthDetailsFromHeader(c *gin.Context, secretKey string) (AuthDetails, error)

func VerifyJWTToken

func VerifyJWTToken(tokenString string, secretKey string) (AuthDetails, error)

type AuthorizationInfo

type AuthorizationInfo struct {
	AccessToken string `json:"access_token"`
	ExpiresIn   int    `json:"expires_in"`
	WcaId       string `json:"wcaid"`
	AvatarUrl   string `json:"avatarUrl"`
	IsAdmin     bool   `json:"isadmin"`
	Username    string `json:"username"`
}

func GetAuthInfo

func GetAuthInfo(code string, envMap map[string]string) (AuthorizationInfo, error)

type AverageInfo

type AverageInfo struct {
	Single              string   `json:"single"`
	Average             string   `json:"average"`
	Times               []string `json:"times"`
	Bpa                 string   `json:"bpa"`
	Wpa                 string   `json:"wpa"`
	ShowPossibleAverage bool     `json:"showPossibleAverage"`
	FinishedCompeting   bool     `json:"finishedCompeting"`
	Place               string   `json:"place"`
	SingleRecord        string   `json:"singleRecord"`
	SingleRecordColor   string   `json:"singleRecordColor"`
	AverageRecord       string   `json:"averageRecord"`
	AverageRecordColor  string   `json:"averageRecordColor"`
}

func (*AverageInfo) LoadRecords

func (averageInfo *AverageInfo) LoadRecords(personalBestEntry ProfileTypePersonalBests)

type BestEntry

type BestEntry struct {
	Single  int
	Average int
}

func GetNewBest

func GetNewBest(
	pBest BestEntry,
	resultEntry ResultEntry,
	noOfSolves int,
	scrambles []string,
) BestEntry

type CompetitionData

type CompetitionData struct {
	Id        string             `json:"id"`
	Name      string             `json:"name"`
	Startdate time.Time          `json:"startdate"`
	Enddate   time.Time          `json:"enddate"`
	Events    []CompetitionEvent `json:"events"`
	Scrambles []ScrambleSet      `json:"scrambles"`
	Results   ResultEntry        `json:"results"`
}

func GetAllCompetitions

func GetAllCompetitions(db *pgxpool.Pool) ([]CompetitionData, error)

func GetCompetitionByIdObject

func GetCompetitionByIdObject(db *pgxpool.Pool, id string) (CompetitionData, error)

func IsValidTimePeriod

func IsValidTimePeriod(db *pgxpool.Pool, competitionId string) (bool, CompetitionData, error)

func (*CompetitionData) AddEvents

func (c *CompetitionData) AddEvents(db *pgxpool.Pool, tx pgx.Tx, event_ids []int, envMap map[string]string) error

func (*CompetitionData) GenerateScrambles

func (c *CompetitionData) GenerateScrambles(envMap map[string]string) error

func (*CompetitionData) GetEvents

func (c *CompetitionData) GetEvents(db *pgxpool.Pool) error

func (*CompetitionData) GetScrambles

func (c *CompetitionData) GetScrambles(db *pgxpool.Pool) error

func (*CompetitionData) RecomputeCompetitionId

func (competition *CompetitionData) RecomputeCompetitionId()

func (*CompetitionData) RemoveAllEvents

func (c *CompetitionData) RemoveAllEvents(db *pgxpool.Pool, tx pgx.Tx) ([]int, error)

type CompetitionEvent

type CompetitionEvent struct {
	Id              int    `json:"id"`
	Fulldisplayname string `json:"fulldisplayname"`
	Displayname     string `json:"displayname"`
	Format          string `json:"format"`
	Iconcode        string `json:"iconcode"`
	Scramblingcode  string `json:"scramblingcode"`
}

func GetAvailableEvents

func GetAvailableEvents(db *pgxpool.Pool) ([]CompetitionEvent, error)

func GetEventById

func GetEventById(db *pgxpool.Pool, eventId int) (CompetitionEvent, error)

func (*CompetitionEvent) HasScrambles

func (e *CompetitionEvent) HasScrambles(db *pgxpool.Pool, tx pgx.Tx, cid string) (bool, error)

type CompetitionEvents

type CompetitionEvents struct {
	Id             int
	Competition_id string
	Event_id       int
}

type CompetitionResult

type CompetitionResult struct {
	Place       string   `json:"place"`
	Username    string   `json:"username"`
	WcaId       string   `json:"wca_id"`
	CountryName string   `json:"country_name"`
	CountryIso2 string   `json:"country_iso2"`
	Single      string   `json:"single"`
	Average     string   `json:"average"`
	Times       []string `json:"times"`
	Score       string   `json:"score"`
	UserId      int      `json:"-"`
	Comment     string   `json:"comment"`
}

func GetOverallResults

func GetOverallResults(
	db *pgxpool.Pool,
	cid, regionGroup, region string,
) ([]CompetitionResult, error)

cid = "" is for all competitions, i.e. GetRankings

func GetResultsFromCompetitionFromRows

func GetResultsFromCompetitionFromRows(
	rows []EventResultsRow,
	db *pgxpool.Pool,
) ([]CompetitionResult, error)

func GetScores

func GetScores(
	rows []KinchQueryRow,
	bests map[int]BestEntry,
	noOfEvents int,
	db *pgxpool.Pool,
) ([]CompetitionResult, error)

type CompetitionResultStruct

type CompetitionResultStruct struct {
	Results    []CompetitionResult `json:"results"`
	AnyComment bool                `json:"anyComment"`
}

func GetResultsFromCompetitionByEventName

func GetResultsFromCompetitionByEventName(
	db *pgxpool.Pool,
	cid string,
	eid int,
) (CompetitionResultStruct, error)

type Country

type Country struct {
	Id   string `json:"id"`
	Name string `json:"name"`
	Iso2 string `json:"iso2"`
}

func GetCountries

func GetCountries(db *pgxpool.Pool) ([]Country, error)

func GetCountryByName

func GetCountryByName(db *pgxpool.Pool, name string) (Country, error)

type EmojiCounter

type EmojiCounter struct {
	Id             int    `json:"-"`
	AnnouncementId int    `json:"announcementId"`
	Emoji          string `json:"emoji"`
	By             string `json:"by"`
	Set            bool   `json:"-"`
}

func (*EmojiCounter) Update

func (ec *EmojiCounter) Update(conn *pgxpool.Conn, userId int) error

type EventResultsRow

type EventResultsRow struct {
	ResultEntry ResultEntry
	Date        time.Time
	ContinentId string
	CountryId   string
	CountryName string
	CountryIso2 string
}

func LoadEventRows

func LoadEventRows(db *pgxpool.Pool, eid int) ([]EventResultsRow, error)

type Feature

type Feature struct {
	Type       string   `json:"type"`
	Properties Property `json:"properties"`
	Geometry   Geometry `json:"geometry"`
}

type FeatureCollection

type FeatureCollection struct {
	Type     string    `json:"type"`
	Features []Feature `json:"features"`
}

type Geometry

type Geometry struct {
	Type        string        `json:"type"`
	Coordinates []interface{} `json:"coordinates"`
}

type GetWCACompetitionsResponse

type GetWCACompetitionsResponse struct {
	Id               string    `json:"id"`
	Name             string    `json:"name"`
	Startdate        string    `json:"start_date"`
	Enddate          string    `json:"end_date"`
	RegistrationOpen time.Time `json:"registration_open"`
	CompetitorLimit  int       `json:"competitor_limit"`
	Url              string    `json:"url"`
	CountryIso2      string    `json:"country_iso2"`
	VenueAddress     string    `json:"venue_address"`
	City             string    `json:"city"`
	EventIds         []string  `json:"event_ids"`
}

type KinchQueryRow

type KinchQueryRow struct {
	CompetitionResult CompetitionResult
	ResultEntry       ResultEntry
}

func GetKinchQueryRows

func GetKinchQueryRows(rawRows pgx.Rows, db *pgxpool.Pool) ([]KinchQueryRow, error)

type ManageRolesUser

type ManageRolesUser struct {
	Id      int    `json:"id"`
	Name    string `json:"name"`
	Isadmin bool   `json:"isadmin"`
}

type MapDataUser

type MapDataUser struct {
	Username string `json:"username"`
	WcaId    string `json:"wcaid"`
	Score    string `json:"score"`
}

type MedalCollection

type MedalCollection struct {
	Gold   int `json:"gold"`
	Silver int `json:"silver"`
	Bronze int `json:"bronze"`
}

type OverallQueryStruct

type OverallQueryStruct struct {
	Query string
	Args  []any
}

func ConstructOverallResultsQuery

func ConstructOverallResultsQuery(cid, regionGroup, region string) OverallQueryStruct

type PersonalBestEntry

type PersonalBestEntry struct {
	NR    string `json:"nr"`
	CR    string `json:"cr"`
	WR    string `json:"wr"`
	Value string `json:"value"`
}

type PersonalBestRanks

type PersonalBestRanks struct {
	Single  Ranks
	Average Ranks
}

func GetRankFromResults

func GetRankFromResults(
	results map[int]ResultsSingleAverageEntry,
	single string,
	average string,
	user *User,
) (PersonalBestRanks, error)

func LoadRank

func LoadRank(
	single string,
	average string,
	eid int,
	rows *[]EventResultsRow,
	ismbld bool,
	db *pgxpool.Pool,
	user *User,
) (PersonalBestRanks, error)

type ProfileType

type ProfileType struct {
	Basics           ProfileTypeBasics          `json:"basics"`
	PersonalBests    []ProfileTypePersonalBests `json:"personalBests"`
	MedalCollection  MedalCollection            `json:"medalCollection"`
	RecordCollection RecordCollection           `json:"recordCollection"`
	ResultsHistory   []ProfileTypeResultHistory `json:"resultsHistory"`
}

func (*ProfileType) CountRecordsInEventFromRows

func (p *ProfileType) CountRecordsInEventFromRows(
	eventResultsRows *[]EventResultsRow,
	user *User,
	db *pgxpool.Pool,
) (Recorders, error)

func (*ProfileType) CreateEventHistoryForUser

func (p *ProfileType) CreateEventHistoryForUser(
	db *pgxpool.Pool,
	user *User,
	event CompetitionEvent,
	rows []EventResultsRow,
	recorders Recorders,
) error

func (*ProfileType) Load

func (p *ProfileType) Load(db *pgxpool.Pool, uid int) error

func (*ProfileType) LoadBasics

func (p *ProfileType) LoadBasics(db *pgxpool.Pool, uid int) error

func (*ProfileType) LoadHistory

func (p *ProfileType) LoadHistory(
	db *pgxpool.Pool,
	user *User,
	recorders map[int]Recorders,
	rows map[int][]EventResultsRow,
) error

func (*ProfileType) LoadPersonalBests

func (p *ProfileType) LoadPersonalBests(
	db *pgxpool.Pool,
	user *User,
	eid int,
) (map[int][]EventResultsRow, error)

eid = 0 - all events, eid > 0 - only event with that id

func (*ProfileType) LoadRecordCollection

func (p *ProfileType) LoadRecordCollection(
	db *pgxpool.Pool,
	user *User,
	rows map[int][]EventResultsRow,
) (map[int]Recorders, error)

type ProfileTypeBasics

type ProfileTypeBasics struct {
	Name             string                  `json:"name"`
	Imageurl         string                  `json:"imageurl"`
	Region           ProfileTypeBasicsRegion `json:"region"`
	Wcaid            string                  `json:"wcaid"`
	Sex              string                  `json:"sex"`
	NoOfCompetitions int                     `json:"noOfCompetitions"`
	CompletedSolves  int                     `json:"completedSolves"`
}

type ProfileTypeBasicsRegion

type ProfileTypeBasicsRegion struct {
	Name string `json:"name"`
	Iso2 string `json:"iso2"`
}

type ProfileTypePersonalBests

type ProfileTypePersonalBests struct {
	EventId       int               `json:"eventid"`
	EventName     string            `json:"eventName"`
	EventIconCode string            `json:"eventIconcode"`
	Average       PersonalBestEntry `json:"average"`
	Single        PersonalBestEntry `json:"single"`
	Event         CompetitionEvent  `json:"-"`
}

func (*ProfileTypePersonalBests) ClearAverage

func (p *ProfileTypePersonalBests) ClearAverage()

func (*ProfileTypePersonalBests) ClearSingle

func (p *ProfileTypePersonalBests) ClearSingle()

func (*ProfileTypePersonalBests) LoadSingleAndAverage

func (p *ProfileTypePersonalBests) LoadSingleAndAverage(
	db *pgxpool.Pool,
	user *User,
	resultEntries *[]ResultEntry,
	ismbld bool,
) ([]EventResultsRow, error)

type ProfileTypeResultHistory

type ProfileTypeResultHistory struct {
	EventId       int                             `json:"eventId"`
	EventName     string                          `json:"eventName"`
	EventIconCode string                          `json:"eventIconcode"`
	EventFormat   string                          `json:"eventFormat"`
	History       []ProfileTypeResultHistoryEntry `json:"history"`
}

type ProfileTypeResultHistoryEntry

type ProfileTypeResultHistoryEntry struct {
	CompetitionId      string    `json:"competitionId"`
	CompetitionName    string    `json:"competitionName"`
	CompetitionEnddate time.Time `json:"-"`
	Place              string    `json:"place"`
	Single             string    `json:"single"`
	Average            string    `json:"average"`
	Solves             []string  `json:"solves"`
	SingleRecord       string    `json:"singleRecord"`
	AverageRecord      string    `json:"averageRecord"`
	SingleRecordColor  string    `json:"singleRecordColor"`
	AverageRecordColor string    `json:"averageRecordColor"`
}

type Property

type Property struct {
	Name        string        `json:"name"`
	CountryIso2 string        `json:"countryIso2"`
	Users       []MapDataUser `json:"users"`
}

type RankResultsEntry

type RankResultsEntry struct {
	Value       int
	ContinentId int
	CountryId   int
}

type RankingsEntry

type RankingsEntry struct {
	Place           string   `json:"place"`
	Username        string   `json:"username"`
	WcaId           string   `json:"wca_id"`
	CountryISO2     string   `json:"country_iso2"`
	CountryName     string   `json:"country_name"`
	Result          string   `json:"result"`
	CompetitionId   string   `json:"competitionId"`
	CompetitionName string   `json:"competitionName"`
	Times           []string `json:"times"`
}

func (*RankingsEntry) Load

func (rankingsEntry *RankingsEntry) Load(single, persons bool, resultsEntry ResultEntry, isfmc, ismbld bool, scrambles []string, rankings *[]RankingsEntry, regionType, regionPrecise string) (string, string, error)

type Ranks

type Ranks struct {
	NR string
	CR string
	WR string
}

type RecordCollection

type RecordCollection struct {
	NR int `json:"nr"`
	CR int `json:"cr"`
	WR int `json:"wr"`
}

type Recorders

type Recorders struct {
	WR map[time.Time]RecordersEntry
	CR map[time.Time]RecordersEntry
	NR map[time.Time]RecordersEntry
}

type RecordersEntry

type RecordersEntry struct {
	// contains filtered or unexported fields
}

type ResultEntry

type ResultEntry struct {
	Id              int           `json:"id"`
	Userid          int           `json:"userid"`
	Username        string        `json:"username"`
	WcaId           string        `json:"wcaid"`
	Competitionid   string        `json:"competitionid"`
	Competitionname string        `json:"competitionname"`
	Eventid         int           `json:"eventid"`
	Eventname       string        `json:"eventname"`
	Iconcode        string        `json:"iconcode"`
	Format          string        `json:"format"`
	Solve1          string        `json:"solve1"`
	Solve2          string        `json:"solve2"`
	Solve3          string        `json:"solve3"`
	Solve4          string        `json:"solve4"`
	Solve5          string        `json:"solve5"`
	Comment         string        `json:"comment"`
	Status          ResultsStatus `json:"status"`
	BadFormat       bool          `json:"badFormat"`
	Scrambles       []string      `json:"-"`
	Email           string        `json:"-"`
}

func GetPersonalResultEntriesInEvent

func GetPersonalResultEntriesInEvent(db *pgxpool.Pool, uid int, eid int) ([]ResultEntry, error)

func GetResultEntry

func GetResultEntry(
	db *pgxpool.Pool,
	competitorId int,
	competitionId string,
	eventId int,
) (ResultEntry, error)

func GetResultEntryById

func GetResultEntryById(db *pgxpool.Pool, resultId int) (ResultEntry, error)

func (*ResultEntry) Average

func (r *ResultEntry) Average(noOfSolves int, isfmc bool, scrambles []string) int

func (*ResultEntry) AverageFormatted

func (r *ResultEntry) AverageFormatted(isfmc bool, scrambles []string) (string, error)

func (*ResultEntry) CheckFormats

func (r *ResultEntry) CheckFormats(isfmc bool)

func (*ResultEntry) Competed

func (r *ResultEntry) Competed() bool

func (*ResultEntry) FinishedCompeting

func (r *ResultEntry) FinishedCompeting() (bool, error)

func (*ResultEntry) FormatMultiSingle

func (r *ResultEntry) FormatMultiSingle(single int) string

func (*ResultEntry) GetBPA

func (r *ResultEntry) GetBPA() (string, error)

load scrambles first into resultEntry.Scrambles

func (*ResultEntry) GetCompetitionPlace

func (r *ResultEntry) GetCompetitionPlace(db *pgxpool.Pool) (string, error)

func (*ResultEntry) GetFormattedTimes

func (r *ResultEntry) GetFormattedTimes(isfmc bool, scrambles []string) ([]string, error)

func (*ResultEntry) GetNthSolve

func (r *ResultEntry) GetNthSolve(noOfSolves int) string

func (*ResultEntry) GetPreviouslySavedTimes

func (r *ResultEntry) GetPreviouslySavedTimes(db *pgxpool.Pool) ([]string, error)

func (*ResultEntry) GetSolveIdx

func (r *ResultEntry) GetSolveIdx(s string) int

func (*ResultEntry) GetSolves

func (r *ResultEntry) GetSolves(isfmc bool, scrambles []string) []string

func (*ResultEntry) GetSolvesInMiliseconds

func (r *ResultEntry) GetSolvesInMiliseconds(isfmc bool, scrambles []string) []int

func (*ResultEntry) GetSuspicousChangeTimesHTML

func (r *ResultEntry) GetSuspicousChangeTimesHTML(
	previouslySavedTimes []string,
	noOfSolves int,
	oldTimesFormatted, newTimesFormatted []string,
) string

func (*ResultEntry) GetWPA

func (r *ResultEntry) GetWPA() (string, error)

func (*ResultEntry) Insert

func (r *ResultEntry) Insert(db *pgxpool.Pool) error

func (*ResultEntry) IsAverageOfX

func (r *ResultEntry) IsAverageOfX() bool

func (*ResultEntry) IsFMC

func (r *ResultEntry) IsFMC() bool

func (*ResultEntry) IsMBLD

func (r *ResultEntry) IsMBLD() bool

func (*ResultEntry) IsSuspicous

func (r *ResultEntry) IsSuspicous(isfmc bool, scrambles []string) bool

func (*ResultEntry) LoadId

func (r *ResultEntry) LoadId(db *pgxpool.Pool) error

func (*ResultEntry) SendSuspicousMail

func (r *ResultEntry) SendSuspicousMail(
	c *gin.Context,
	db *pgxpool.Pool,
	envMap map[string]string,
	previouslySavedTimes []string,
)

func (*ResultEntry) SetNthSolve

func (r *ResultEntry) SetNthSolve(noOfSolves int, newSolveValue string)

func (*ResultEntry) ShowPossibleAverages

func (r *ResultEntry) ShowPossibleAverages() (bool, error)

r.Format must be set

func (*ResultEntry) Single

func (r *ResultEntry) Single(isfmc bool, scrambles []string) int

func (*ResultEntry) SingleFormatted

func (r *ResultEntry) SingleFormatted(isfmc bool, scrambles []string) string

func (*ResultEntry) SuspicousChangeInResults

func (r *ResultEntry) SuspicousChangeInResults(previouslySavedTimes []string, noOfSolves int) bool

func (*ResultEntry) Update

func (r *ResultEntry) Update(db *pgxpool.Pool, isadmin bool, isfmc bool, valid ...bool) error

func (*ResultEntry) Validate

func (r *ResultEntry) Validate(db *pgxpool.Pool, isfmc bool, scrambles []string) error

func (*ResultEntry) ValidateMultiEntry

func (r *ResultEntry) ValidateMultiEntry(entry string) string

type ResultsSingleAverageEntry

type ResultsSingleAverageEntry struct {
	Single      int
	Average     int
	ContinentId string
	CountryId   string
}

type ResultsStatus

type ResultsStatus struct {
	Id               int    `json:"id"`
	ApprovalFinished bool   `json:"approvalFinished"`
	Approved         bool   `json:"approved"`
	Visible          bool   `json:"visible"`
	Displayname      string `json:"displayname"`
}

func GetAvailableResultsStatuses

func GetAvailableResultsStatuses(db *pgxpool.Pool) ([]ResultsStatus, error)

func GetResultsStatus

func GetResultsStatus(db *pgxpool.Pool, statusId int) (ResultsStatus, error)

type Scramble

type Scramble struct {
	Scramble string `json:"scramble"`
	Img      string `json:"img"`
}

type ScrambleSet

type ScrambleSet struct {
	Event     CompetitionEvent `json:"event"`
	Scrambles []Scramble       `json:"scrambles"`
}

func (*ScrambleSet) AddScramble

func (s *ScrambleSet) AddScramble(scramble Scramble)

type SearchUser

type SearchUser struct {
	Id       int    `json:"-"`
	Username string `json:"username"`
	WCAID    string `json:"wcaid"`
}

func GetUsersFromDB

func GetUsersFromDB(tx pgx.Tx, query string) ([]SearchUser, int, string, string)

func (*SearchUser) CreateAnnouncementReadConnection

func (u *SearchUser) CreateAnnouncementReadConnection(tx pgx.Tx, aid int) error

type Tag

type Tag struct {
	Id    int    `json:"id"`
	Label string `json:"label"`
	Color string `json:"color"`
}

func GetAvailableTags

func GetAvailableTags(db *pgxpool.Pool) ([]Tag, error)

func GetCompetitionAnnouncementTag

func GetCompetitionAnnouncementTag(db *pgxpool.Pool) (Tag, error)

type UpcomingWCACompetition

type UpcomingWCACompetition struct {
	Id               string             `json:"id"`
	Name             string             `json:"name"`
	Startdate        time.Time          `json:"startdate"`
	Enddate          time.Time          `json:"enddate"`
	Registered       int                `json:"registered"`
	RegistrationOpen time.Time          `json:"registrationOpen"`
	CompetitorLimit  int                `json:"competitorLimit"`
	VenueAddress     string             `json:"venueAddress"`
	Url              string             `json:"url"`
	Events           []CompetitionEvent `json:"events"`
	CountryId        string             `json:"-"`
	CountryName      string             `json:"-"`
	CountryIso2      string             `json:"-"`
}

func (*UpcomingWCACompetition) DateFormatted

func (c *UpcomingWCACompetition) DateFormatted() string

func (*UpcomingWCACompetition) DeleteEvents

func (c *UpcomingWCACompetition) DeleteEvents(db pgx.Tx) error

func (*UpcomingWCACompetition) GetEventNamesFromCompetitionEvents

func (c *UpcomingWCACompetition) GetEventNamesFromCompetitionEvents(
	events []CompetitionEvent,
) []string

func (*UpcomingWCACompetition) GetRegistered

func (c *UpcomingWCACompetition) GetRegistered(db pgx.Tx) error

func (*UpcomingWCACompetition) Save

func (c *UpcomingWCACompetition) Save(db pgx.Tx) (pgconn.CommandTag, error)

func (*UpcomingWCACompetition) SaveEvents

func (c *UpcomingWCACompetition) SaveEvents(db pgx.Tx) error

func (*UpcomingWCACompetition) UpdateEvents

func (c *UpcomingWCACompetition) UpdateEvents(db pgx.Tx) error

type UpcomingWCACompetitionRegistration

type UpcomingWCACompetitionRegistration struct {
	Id int `json:"id"`
}

type UpdateWCAAnnouncementSubscriptionsRequestBody

type UpdateWCAAnnouncementSubscriptionsRequestBody struct {
	CountryName string `json:"countryName"`
	Subscribed  bool   `json:"subscribed"`
}

type User

type User struct {
	Id          int    `json:"id"`
	Name        string `json:"name"`
	CountryId   string `json:"country_id"`
	ContinentId string `json:"continent_id"`
	Sex         string `json:"sex"`
	WcaId       string `json:"wcaid"`
	IsAdmin     bool   `json:"isadmin"`
	Url         string `json:"url"`
	AvatarUrl   string `json:"avatarurl"`
	Email       string `json:"-"`
}

func GetUserById

func GetUserById(db *pgxpool.Pool, uid int) (User, error)

func GetUserInfoFromWCA

func GetUserInfoFromWCA(authInfo *AuthorizationInfo, envMap map[string]string) (User, error)

func (*User) CreateAllAnnouncementReadConnection

func (u *User) CreateAllAnnouncementReadConnection(db *pgxpool.Pool) error

func (*User) Exists

func (u *User) Exists(db *pgxpool.Pool) (bool, error)

func (*User) Insert

func (u *User) Insert(db *pgxpool.Pool) error

func (*User) LoadContinent

func (u *User) LoadContinent(db *pgxpool.Pool) error

func (*User) Update

func (u *User) Update(db *pgxpool.Pool) error

type WCACompAnnouncementSubscriptions

type WCACompAnnouncementSubscriptions struct {
	Id          int    `json:"-"`
	CountryId   string `json:"countryId"`
	CountryName string `json:"countryName"`
	Subscribed  bool   `json:"subscribed"`
}

Jump to

Keyboard shortcuts

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