Add more gitignore

This commit is contained in:
Henri Burau
2024-06-04 14:27:09 +02:00
parent a793da1307
commit e2b9b8f176
28 changed files with 316 additions and 3176 deletions

View File

@ -11,27 +11,26 @@ import (
type MapScoreList []MapScore
type Capture struct {
ID int64 `bun:",pk,autoincrement"`
Host string
Port string
Name string
Active bool
Start time.Time
ID int64 `bun:",pk,autoincrement"`
Host string `bun:",notnull"`
Port string `bun:",notnull"`
Name string `bun:",unique,notnull"`
Active bool `bun:",notnull"`
Start time.Time `bun:",notnull,default:current_timestamp"`
MapScores MapScoreList `bun:"rel:has-many,join:id=capture_id"`
}
type MapScore struct {
ID int64 `bun:",pk,autoincrement"`
CaptureID int64 `bun:"capture_id"`
StartTime time.Time
Map string
ScoreList []Score `bun:"rel:has-many,join:id=mapscore_id"`
ID int64 `bun:",pk,autoincrement"`
CaptureID int64 `bun:"capture_id"`
StartTime time.Time `bun:",notnull"`
Map string `bun:",notnull"`
ScoreList []Score `bun:"rel:has-many,join:id=mapscore_id"`
}
type Score struct {
ID int64 `bun:",pk,autoincrement"`
MapScoreID int64 `bun:"mapscore_id"`
Name string
Name string `bun:",pk,notnull"`
MapScoreID int64 `bun:"mapscore_id,pk,notnull"`
Score int
Ping int
}
@ -57,7 +56,7 @@ func (msl MapScoreList) BuildTable() *ResultTable {
Header: []ResultTableHeader{{Title: "Name"}, {Title: "Total"}},
}
userMapRows := make(map[string]*ResultTableRow)
userMapRows := make(map[string]int)
for mapIndex, mapScore := range msl {
rt.Header = append(rt.Header, ResultTableHeader{
@ -73,12 +72,12 @@ func (msl MapScoreList) BuildTable() *ResultTable {
Individual: make([]int, len(msl)),
})
userMapRows[score.Name] = &rt.Rows[len(rt.Rows)-1]
userMapRows[score.Name] = len(rt.Rows) - 1
}
row := userMapRows[score.Name]
row.Total = row.Total + score.Score
row.Individual[mapIndex] = score.Score
rt.Rows[row].Total = rt.Rows[row].Total + score.Score
rt.Rows[row].Individual[mapIndex] = score.Score
}
}
}