Update all the shit

This commit is contained in:
Henri Burau
2024-06-07 00:07:29 +02:00
parent ddbfc32fb1
commit 18265f59df
43 changed files with 609 additions and 182 deletions

View File

@ -25,6 +25,7 @@ type MapScore struct {
CaptureID int64 `bun:"capture_id"`
StartTime time.Time `bun:",notnull"`
Map string `bun:",notnull"`
Counted bool `bun:",notnull"`
ScoreList []Score `bun:"rel:has-many,join:id=mapscore_id"`
}
@ -60,8 +61,15 @@ func (msl MapScoreList) BuildTable() *ResultTable {
rt.Header = append(rt.Header, make([]ResultTableHeader, len(msl))...)
for mapIndex, mapScore := range msl {
reversedIndex := len(msl) - 1 - mapIndex
filteredMapScores := []MapScore{}
for _, ms := range msl {
if ms.Counted {
filteredMapScores = append(filteredMapScores, ms)
}
}
for mapIndex, mapScore := range filteredMapScores {
reversedIndex := len(filteredMapScores) - 1 - mapIndex
rt.Header[reversedIndex+2] = ResultTableHeader{
Title: mapScore.Map,
@ -73,7 +81,7 @@ func (msl MapScoreList) BuildTable() *ResultTable {
rt.Rows = append(rt.Rows, ResultTableRow{
Name: score.Name,
Total: 0,
Individual: make([]int, len(msl)),
Individual: make([]int, len(filteredMapScores)),
})
userMapRows[score.Name] = len(rt.Rows) - 1