result

package
v0.0.0-...-d48d45f Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2024 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DNF = -10000 - iota
	DNS
)

Variables

This section is empty.

Functions

func SortResultsAndUpdateRank

func SortResultsAndUpdateRank(rt RouteType, in []Results)

func SortResultsByAvg

func SortResultsByAvg(in []Results)

func SortResultsByBest

func SortResultsByBest(in []Results)

SortResultsByBest 先看best 再看平均

Types

type Event

type Event struct {
	basemodel.StringIDModel

	EventI18NJSON string      `gorm:"column:events"`
	EventI18N     []EventI18N `gorm:"-"`
	IsComp        bool        `gorm:"column:is_comp"`     // 比赛项目
	Icon          string      `gorm:"column:icon"`        // Icon
	IconBase64    string      `gorm:"column:icon_base64"` // Icon base64
	IsWCA         bool        `gorm:"column:is_wca"`      // WCA项目
	RouteType     RouteType   `gorm:"column:route_typ"`   // 轮次
}

func (*Event) AfterFind

func (c *Event) AfterFind(tx *gorm.DB) (err error)

type EventI18N

type EventI18N struct {
	Language string `json:"language"`
	Name     string `json:"name"`
	Long     string `json:"long"`
	Class    string `json:"class"` // 分类
}

type EventName

type EventName = string

type Penalty

type Penalty [][]float64

type PreResults

type PreResults struct {
	Results

	CompsName    string `gorm:"column:comps_name"`    // 比赛名
	RoundName    string `gorm:"column:round_name"`    // 轮次名
	Recorder     string `gorm:"column:recorder"`      // 记录人
	Processor    string `gorm:"column:processor"`     //  处理人ID
	Finish       bool   `gorm:"column:finish"`        // 是否处理
	FinishDetail string `gorm:"column:finish_detail"` // 处理结果
	Source       string `gorm:"column:source"`        // 来源
}

type Record

type Record struct {
	basemodel.Model

	EventId    string           `gorm:"column:event_id"`    // 项目ID
	EventRoute RouteType        `gorm:"column:route_type"`  // 项目类型
	ResultId   string           `gorm:"column:result_id"`   // 成绩ID
	UserId     uint             `gorm:"column:user_id"`     // 用户ID
	UserName   string           `gorm:"column:user_name"`   // 用户名
	CompsId    string           `gorm:"column:comps_id"`    // 比赛ID
	CompsGenre compertion.Genre `gorm:"column:comps_genre"` // 比赛类型
	Best       *float64         `gorm:"column:best"`        // 最佳成绩
	Average    *float64         `gorm:"column:average"`     // 平均成绩
	Repeatedly *string          `gorm:"column:repeatedly"`  // 多次尝试成绩
}

type Results

type Results struct {
	basemodel.Model

	CompetitionID  string    `gorm:"column:comp_id"`         // 比赛ID
	EventID        string    `gorm:"column:event_id"`        // 项目
	EventRoute     RouteType `gorm:"column:route_type"`      // 项目类型
	Route          uint      `gorm:"column:route"`           // 轮次
	PersonName     string    `gorm:"column:person_name"`     // 玩家名
	UserID         uint      `gorm:"column:user_id"`         // ID
	Best           float64   `gorm:"column:best"`            // 最佳成绩
	BestRepeatedly float64   `gorm:"column:best_repeatedly"` // 多次尝试的成绩
	Average        float64   `gorm:"column:average"`         // 平均成绩
	ResultJSON     string    `gorm:"column:result_json"`     // 成绩列表JSON
	Result         []float64 `gorm:"-"`                      // 成绩数据
	PenaltyJSON    string    `gorm:"column:penalty_json"`    // 判罚
	Penalty        Penalty   `gorm:"-"`                      // 判罚列表
}

func (*Results) AfterFind

func (c *Results) AfterFind(*gorm.DB) error

func (*Results) BeforeCreate

func (c *Results) BeforeCreate(*gorm.DB) error

func (*Results) BeforeSave

func (c *Results) BeforeSave(*gorm.DB) error

func (*Results) BeforeUpdate

func (c *Results) BeforeUpdate(*gorm.DB) error

func (*Results) D

func (c *Results) D() bool

func (*Results) DAvg

func (c *Results) DAvg() bool

func (*Results) DBest

func (c *Results) DBest() bool

func (*Results) IsBest

func (c *Results) IsBest(other Results) bool

func (*Results) IsBestAvg

func (c *Results) IsBestAvg(other Results) bool

func (*Results) Update

func (c *Results) Update() error

type RouteType

type RouteType int
const (
	RouteTypeNot             RouteType = iota // 非比赛项目
	RouteType1rounds                          // "1_r"      // 单轮项目
	RouteType3roundsBest                      // "3_r_b"    // 三轮取最佳
	RouteType3roundsAvg                       // "3_r_a"    // 三轮取平均
	RouteType5roundsBest                      // "5_r_b"    // 五轮取最佳
	RouteType5roundsAvg                       // "5_r_a"    // 五轮取平均
	RouteType5RoundsAvgHT                     // "5_r_a_ht" // 五轮去头尾取平均
	RouteTypeRepeatedly                       // "ry"       // 单轮多次还原项目, 成绩1:还原数; 成绩2:尝试数; 成绩3:时间;
	RouteType3RepeatedlyBest                  // "3ry"      // 三轮尝试多次还原项目 成绩1:还原数; 成绩2:尝试数; 成绩3:时间; 循环3次
)

func (RouteType) N

func (r RouteType) N() int

N 该项目需要的成绩数

func (RouteType) WithBest

func (r RouteType) WithBest() bool

WithBest 排名基于最佳成绩

Jump to

Keyboard shortcuts

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