removed unneeded field, fixed not setting spent amount

This commit is contained in:
2021-10-17 04:17:02 +02:00
parent fd8c026a8e
commit 9973951d4b
9 changed files with 12 additions and 285 deletions

View File

@@ -4,7 +4,6 @@ package ent
import (
"csgowtfd/ent/match"
"encoding/json"
"fmt"
"strings"
"time"
@@ -37,14 +36,6 @@ type Match struct {
MaxRounds int `json:"max_rounds,omitempty"`
// DemoParsed holds the value of the "demo_parsed" field.
DemoParsed bool `json:"demo_parsed,omitempty"`
// Eco holds the value of the "eco" field.
Eco struct {
Rounds []*struct {
Team int "json:\"team\""
Bank int "json:\"bank\""
Equipment int "json:\"equipment\""
} "json:\"rounds\""
} `json:"eco,omitempty"`
// Edges holds the relations/edges for other nodes in the graph.
// The values are being populated by the MatchQuery when eager-loading is set.
Edges MatchEdges `json:"edges"`
@@ -84,8 +75,6 @@ func (*Match) scanValues(columns []string) ([]interface{}, error) {
values := make([]interface{}, len(columns))
for i := range columns {
switch columns[i] {
case match.FieldEco:
values[i] = new([]byte)
case match.FieldDemoParsed:
values[i] = new(sql.NullBool)
case match.FieldID, match.FieldScoreTeamA, match.FieldScoreTeamB, match.FieldDuration, match.FieldMatchResult, match.FieldMaxRounds:
@@ -175,14 +164,6 @@ func (m *Match) assignValues(columns []string, values []interface{}) error {
} else if value.Valid {
m.DemoParsed = value.Bool
}
case match.FieldEco:
if value, ok := values[i].(*[]byte); !ok {
return fmt.Errorf("unexpected type %T for field eco", values[i])
} else if value != nil && len(*value) > 0 {
if err := json.Unmarshal(*value, &m.Eco); err != nil {
return fmt.Errorf("unmarshal field eco: %w", err)
}
}
}
}
return nil
@@ -241,8 +222,6 @@ func (m *Match) String() string {
builder.WriteString(fmt.Sprintf("%v", m.MaxRounds))
builder.WriteString(", demo_parsed=")
builder.WriteString(fmt.Sprintf("%v", m.DemoParsed))
builder.WriteString(", eco=")
builder.WriteString(fmt.Sprintf("%v", m.Eco))
builder.WriteByte(')')
return builder.String()
}