fixed match win/loss/ties

This commit is contained in:
2021-10-08 17:15:06 +02:00
parent 1fda101a35
commit 1816c5a2b5
28 changed files with 363 additions and 654 deletions

View File

@@ -16,9 +16,7 @@ import (
type Match struct {
config `json:"-"`
// ID of the ent.
ID int `json:"id,omitempty"`
// MatchID holds the value of the "match_id" field.
MatchID uint64 `json:"match_id,string"`
ID uint64 `json:"match_id,string"`
// ShareCode holds the value of the "share_code" field.
ShareCode string `json:"share_code,omitempty"`
// Map holds the value of the "map" field.
@@ -92,7 +90,7 @@ func (*Match) scanValues(columns []string) ([]interface{}, error) {
values[i] = new([]byte)
case match.FieldDemoExpired, match.FieldDemoParsed:
values[i] = new(sql.NullBool)
case match.FieldID, match.FieldMatchID, match.FieldScoreTeamA, match.FieldScoreTeamB, match.FieldDuration, match.FieldMatchResult, match.FieldMaxRounds:
case match.FieldID, match.FieldScoreTeamA, match.FieldScoreTeamB, match.FieldDuration, match.FieldMatchResult, match.FieldMaxRounds:
values[i] = new(sql.NullInt64)
case match.FieldShareCode, match.FieldMap, match.FieldReplayURL:
values[i] = new(sql.NullString)
@@ -118,13 +116,7 @@ func (m *Match) assignValues(columns []string, values []interface{}) error {
if !ok {
return fmt.Errorf("unexpected type %T for field id", value)
}
m.ID = int(value.Int64)
case match.FieldMatchID:
if value, ok := values[i].(*sql.NullInt64); !ok {
return fmt.Errorf("unexpected type %T for field match_id", values[i])
} else if value.Valid {
m.MatchID = uint64(value.Int64)
}
m.ID = uint64(value.Int64)
case match.FieldShareCode:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field share_code", values[i])
@@ -237,8 +229,6 @@ func (m *Match) String() string {
var builder strings.Builder
builder.WriteString("Match(")
builder.WriteString(fmt.Sprintf("id=%v", m.ID))
builder.WriteString(", match_id=")
builder.WriteString(fmt.Sprintf("%v", m.MatchID))
builder.WriteString(", share_code=")
builder.WriteString(m.ShareCode)
builder.WriteString(", map=")