tracking tickrate
This commit is contained in:
@@ -446,7 +446,11 @@ func (p *DemoParser) parseWorker() {
|
||||
continue
|
||||
}
|
||||
|
||||
err = tMatch.Update().SetMap(demoParser.Header().MapName).SetDemoParsed(true).Exec(context.Background())
|
||||
err = tMatch.Update().
|
||||
SetMap(demoParser.Header().MapName).
|
||||
SetDemoParsed(true).
|
||||
SetTickRate(demoParser.TickRate()).
|
||||
Exec(context.Background())
|
||||
if err != nil {
|
||||
log.Errorf("[DP] Unable to update match %d in database: %v", demo.MatchId, err)
|
||||
continue
|
||||
|
12
ent/match.go
12
ent/match.go
@@ -42,6 +42,8 @@ type Match struct {
|
||||
GamebanPresent bool `json:"gameban_present,omitempty"`
|
||||
// DecryptionKey holds the value of the "decryption_key" field.
|
||||
DecryptionKey []byte `json:"decryption_key,omitempty"`
|
||||
// TickRate holds the value of the "tick_rate" field.
|
||||
TickRate float64 `json:"tick_rate,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"`
|
||||
@@ -85,6 +87,8 @@ func (*Match) scanValues(columns []string) ([]interface{}, error) {
|
||||
values[i] = new([]byte)
|
||||
case match.FieldDemoParsed, match.FieldVacPresent, match.FieldGamebanPresent:
|
||||
values[i] = new(sql.NullBool)
|
||||
case match.FieldTickRate:
|
||||
values[i] = new(sql.NullFloat64)
|
||||
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:
|
||||
@@ -190,6 +194,12 @@ func (m *Match) assignValues(columns []string, values []interface{}) error {
|
||||
} else if value != nil {
|
||||
m.DecryptionKey = *value
|
||||
}
|
||||
case match.FieldTickRate:
|
||||
if value, ok := values[i].(*sql.NullFloat64); !ok {
|
||||
return fmt.Errorf("unexpected type %T for field tick_rate", values[i])
|
||||
} else if value.Valid {
|
||||
m.TickRate = value.Float64
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
@@ -254,6 +264,8 @@ func (m *Match) String() string {
|
||||
builder.WriteString(fmt.Sprintf("%v", m.GamebanPresent))
|
||||
builder.WriteString(", decryption_key=")
|
||||
builder.WriteString(fmt.Sprintf("%v", m.DecryptionKey))
|
||||
builder.WriteString(", tick_rate=")
|
||||
builder.WriteString(fmt.Sprintf("%v", m.TickRate))
|
||||
builder.WriteByte(')')
|
||||
return builder.String()
|
||||
}
|
||||
|
@@ -33,6 +33,8 @@ const (
|
||||
FieldGamebanPresent = "gameban_present"
|
||||
// FieldDecryptionKey holds the string denoting the decryption_key field in the database.
|
||||
FieldDecryptionKey = "decryption_key"
|
||||
// FieldTickRate holds the string denoting the tick_rate field in the database.
|
||||
FieldTickRate = "tick_rate"
|
||||
// EdgeStats holds the string denoting the stats edge name in mutations.
|
||||
EdgeStats = "stats"
|
||||
// EdgePlayers holds the string denoting the players edge name in mutations.
|
||||
@@ -69,6 +71,7 @@ var Columns = []string{
|
||||
FieldVacPresent,
|
||||
FieldGamebanPresent,
|
||||
FieldDecryptionKey,
|
||||
FieldTickRate,
|
||||
}
|
||||
|
||||
var (
|
||||
|
@@ -184,6 +184,13 @@ func DecryptionKey(v []byte) predicate.Match {
|
||||
})
|
||||
}
|
||||
|
||||
// TickRate applies equality check predicate on the "tick_rate" field. It's identical to TickRateEQ.
|
||||
func TickRate(v float64) predicate.Match {
|
||||
return predicate.Match(func(s *sql.Selector) {
|
||||
s.Where(sql.EQ(s.C(FieldTickRate), v))
|
||||
})
|
||||
}
|
||||
|
||||
// ShareCodeEQ applies the EQ predicate on the "share_code" field.
|
||||
func ShareCodeEQ(v string) predicate.Match {
|
||||
return predicate.Match(func(s *sql.Selector) {
|
||||
@@ -1133,6 +1140,96 @@ func DecryptionKeyNotNil() predicate.Match {
|
||||
})
|
||||
}
|
||||
|
||||
// TickRateEQ applies the EQ predicate on the "tick_rate" field.
|
||||
func TickRateEQ(v float64) predicate.Match {
|
||||
return predicate.Match(func(s *sql.Selector) {
|
||||
s.Where(sql.EQ(s.C(FieldTickRate), v))
|
||||
})
|
||||
}
|
||||
|
||||
// TickRateNEQ applies the NEQ predicate on the "tick_rate" field.
|
||||
func TickRateNEQ(v float64) predicate.Match {
|
||||
return predicate.Match(func(s *sql.Selector) {
|
||||
s.Where(sql.NEQ(s.C(FieldTickRate), v))
|
||||
})
|
||||
}
|
||||
|
||||
// TickRateIn applies the In predicate on the "tick_rate" field.
|
||||
func TickRateIn(vs ...float64) predicate.Match {
|
||||
v := make([]interface{}, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
return predicate.Match(func(s *sql.Selector) {
|
||||
// if not arguments were provided, append the FALSE constants,
|
||||
// since we can't apply "IN ()". This will make this predicate falsy.
|
||||
if len(v) == 0 {
|
||||
s.Where(sql.False())
|
||||
return
|
||||
}
|
||||
s.Where(sql.In(s.C(FieldTickRate), v...))
|
||||
})
|
||||
}
|
||||
|
||||
// TickRateNotIn applies the NotIn predicate on the "tick_rate" field.
|
||||
func TickRateNotIn(vs ...float64) predicate.Match {
|
||||
v := make([]interface{}, len(vs))
|
||||
for i := range v {
|
||||
v[i] = vs[i]
|
||||
}
|
||||
return predicate.Match(func(s *sql.Selector) {
|
||||
// if not arguments were provided, append the FALSE constants,
|
||||
// since we can't apply "IN ()". This will make this predicate falsy.
|
||||
if len(v) == 0 {
|
||||
s.Where(sql.False())
|
||||
return
|
||||
}
|
||||
s.Where(sql.NotIn(s.C(FieldTickRate), v...))
|
||||
})
|
||||
}
|
||||
|
||||
// TickRateGT applies the GT predicate on the "tick_rate" field.
|
||||
func TickRateGT(v float64) predicate.Match {
|
||||
return predicate.Match(func(s *sql.Selector) {
|
||||
s.Where(sql.GT(s.C(FieldTickRate), v))
|
||||
})
|
||||
}
|
||||
|
||||
// TickRateGTE applies the GTE predicate on the "tick_rate" field.
|
||||
func TickRateGTE(v float64) predicate.Match {
|
||||
return predicate.Match(func(s *sql.Selector) {
|
||||
s.Where(sql.GTE(s.C(FieldTickRate), v))
|
||||
})
|
||||
}
|
||||
|
||||
// TickRateLT applies the LT predicate on the "tick_rate" field.
|
||||
func TickRateLT(v float64) predicate.Match {
|
||||
return predicate.Match(func(s *sql.Selector) {
|
||||
s.Where(sql.LT(s.C(FieldTickRate), v))
|
||||
})
|
||||
}
|
||||
|
||||
// TickRateLTE applies the LTE predicate on the "tick_rate" field.
|
||||
func TickRateLTE(v float64) predicate.Match {
|
||||
return predicate.Match(func(s *sql.Selector) {
|
||||
s.Where(sql.LTE(s.C(FieldTickRate), v))
|
||||
})
|
||||
}
|
||||
|
||||
// TickRateIsNil applies the IsNil predicate on the "tick_rate" field.
|
||||
func TickRateIsNil() predicate.Match {
|
||||
return predicate.Match(func(s *sql.Selector) {
|
||||
s.Where(sql.IsNull(s.C(FieldTickRate)))
|
||||
})
|
||||
}
|
||||
|
||||
// TickRateNotNil applies the NotNil predicate on the "tick_rate" field.
|
||||
func TickRateNotNil() predicate.Match {
|
||||
return predicate.Match(func(s *sql.Selector) {
|
||||
s.Where(sql.NotNull(s.C(FieldTickRate)))
|
||||
})
|
||||
}
|
||||
|
||||
// HasStats applies the HasEdge predicate on the "stats" edge.
|
||||
func HasStats() predicate.Match {
|
||||
return predicate.Match(func(s *sql.Selector) {
|
||||
|
@@ -140,6 +140,20 @@ func (mc *MatchCreate) SetDecryptionKey(b []byte) *MatchCreate {
|
||||
return mc
|
||||
}
|
||||
|
||||
// SetTickRate sets the "tick_rate" field.
|
||||
func (mc *MatchCreate) SetTickRate(f float64) *MatchCreate {
|
||||
mc.mutation.SetTickRate(f)
|
||||
return mc
|
||||
}
|
||||
|
||||
// SetNillableTickRate sets the "tick_rate" field if the given value is not nil.
|
||||
func (mc *MatchCreate) SetNillableTickRate(f *float64) *MatchCreate {
|
||||
if f != nil {
|
||||
mc.SetTickRate(*f)
|
||||
}
|
||||
return mc
|
||||
}
|
||||
|
||||
// SetID sets the "id" field.
|
||||
func (mc *MatchCreate) SetID(u uint64) *MatchCreate {
|
||||
mc.mutation.SetID(u)
|
||||
@@ -430,6 +444,14 @@ func (mc *MatchCreate) createSpec() (*Match, *sqlgraph.CreateSpec) {
|
||||
})
|
||||
_node.DecryptionKey = value
|
||||
}
|
||||
if value, ok := mc.mutation.TickRate(); ok {
|
||||
_spec.Fields = append(_spec.Fields, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeFloat64,
|
||||
Value: value,
|
||||
Column: match.FieldTickRate,
|
||||
})
|
||||
_node.TickRate = value
|
||||
}
|
||||
if nodes := mc.mutation.StatsIDs(); len(nodes) > 0 {
|
||||
edge := &sqlgraph.EdgeSpec{
|
||||
Rel: sqlgraph.O2M,
|
||||
|
@@ -201,6 +201,33 @@ func (mu *MatchUpdate) ClearDecryptionKey() *MatchUpdate {
|
||||
return mu
|
||||
}
|
||||
|
||||
// SetTickRate sets the "tick_rate" field.
|
||||
func (mu *MatchUpdate) SetTickRate(f float64) *MatchUpdate {
|
||||
mu.mutation.ResetTickRate()
|
||||
mu.mutation.SetTickRate(f)
|
||||
return mu
|
||||
}
|
||||
|
||||
// SetNillableTickRate sets the "tick_rate" field if the given value is not nil.
|
||||
func (mu *MatchUpdate) SetNillableTickRate(f *float64) *MatchUpdate {
|
||||
if f != nil {
|
||||
mu.SetTickRate(*f)
|
||||
}
|
||||
return mu
|
||||
}
|
||||
|
||||
// AddTickRate adds f to the "tick_rate" field.
|
||||
func (mu *MatchUpdate) AddTickRate(f float64) *MatchUpdate {
|
||||
mu.mutation.AddTickRate(f)
|
||||
return mu
|
||||
}
|
||||
|
||||
// ClearTickRate clears the value of the "tick_rate" field.
|
||||
func (mu *MatchUpdate) ClearTickRate() *MatchUpdate {
|
||||
mu.mutation.ClearTickRate()
|
||||
return mu
|
||||
}
|
||||
|
||||
// AddStatIDs adds the "stats" edge to the MatchPlayer entity by IDs.
|
||||
func (mu *MatchUpdate) AddStatIDs(ids ...int) *MatchUpdate {
|
||||
mu.mutation.AddStatIDs(ids...)
|
||||
@@ -494,6 +521,26 @@ func (mu *MatchUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||
Column: match.FieldDecryptionKey,
|
||||
})
|
||||
}
|
||||
if value, ok := mu.mutation.TickRate(); ok {
|
||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeFloat64,
|
||||
Value: value,
|
||||
Column: match.FieldTickRate,
|
||||
})
|
||||
}
|
||||
if value, ok := mu.mutation.AddedTickRate(); ok {
|
||||
_spec.Fields.Add = append(_spec.Fields.Add, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeFloat64,
|
||||
Value: value,
|
||||
Column: match.FieldTickRate,
|
||||
})
|
||||
}
|
||||
if mu.mutation.TickRateCleared() {
|
||||
_spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeFloat64,
|
||||
Column: match.FieldTickRate,
|
||||
})
|
||||
}
|
||||
if mu.mutation.StatsCleared() {
|
||||
edge := &sqlgraph.EdgeSpec{
|
||||
Rel: sqlgraph.O2M,
|
||||
@@ -792,6 +839,33 @@ func (muo *MatchUpdateOne) ClearDecryptionKey() *MatchUpdateOne {
|
||||
return muo
|
||||
}
|
||||
|
||||
// SetTickRate sets the "tick_rate" field.
|
||||
func (muo *MatchUpdateOne) SetTickRate(f float64) *MatchUpdateOne {
|
||||
muo.mutation.ResetTickRate()
|
||||
muo.mutation.SetTickRate(f)
|
||||
return muo
|
||||
}
|
||||
|
||||
// SetNillableTickRate sets the "tick_rate" field if the given value is not nil.
|
||||
func (muo *MatchUpdateOne) SetNillableTickRate(f *float64) *MatchUpdateOne {
|
||||
if f != nil {
|
||||
muo.SetTickRate(*f)
|
||||
}
|
||||
return muo
|
||||
}
|
||||
|
||||
// AddTickRate adds f to the "tick_rate" field.
|
||||
func (muo *MatchUpdateOne) AddTickRate(f float64) *MatchUpdateOne {
|
||||
muo.mutation.AddTickRate(f)
|
||||
return muo
|
||||
}
|
||||
|
||||
// ClearTickRate clears the value of the "tick_rate" field.
|
||||
func (muo *MatchUpdateOne) ClearTickRate() *MatchUpdateOne {
|
||||
muo.mutation.ClearTickRate()
|
||||
return muo
|
||||
}
|
||||
|
||||
// AddStatIDs adds the "stats" edge to the MatchPlayer entity by IDs.
|
||||
func (muo *MatchUpdateOne) AddStatIDs(ids ...int) *MatchUpdateOne {
|
||||
muo.mutation.AddStatIDs(ids...)
|
||||
@@ -1109,6 +1183,26 @@ func (muo *MatchUpdateOne) sqlSave(ctx context.Context) (_node *Match, err error
|
||||
Column: match.FieldDecryptionKey,
|
||||
})
|
||||
}
|
||||
if value, ok := muo.mutation.TickRate(); ok {
|
||||
_spec.Fields.Set = append(_spec.Fields.Set, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeFloat64,
|
||||
Value: value,
|
||||
Column: match.FieldTickRate,
|
||||
})
|
||||
}
|
||||
if value, ok := muo.mutation.AddedTickRate(); ok {
|
||||
_spec.Fields.Add = append(_spec.Fields.Add, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeFloat64,
|
||||
Value: value,
|
||||
Column: match.FieldTickRate,
|
||||
})
|
||||
}
|
||||
if muo.mutation.TickRateCleared() {
|
||||
_spec.Fields.Clear = append(_spec.Fields.Clear, &sqlgraph.FieldSpec{
|
||||
Type: field.TypeFloat64,
|
||||
Column: match.FieldTickRate,
|
||||
})
|
||||
}
|
||||
if muo.mutation.StatsCleared() {
|
||||
edge := &sqlgraph.EdgeSpec{
|
||||
Rel: sqlgraph.O2M,
|
||||
|
@@ -24,6 +24,7 @@ var (
|
||||
{Name: "vac_present", Type: field.TypeBool, Default: false},
|
||||
{Name: "gameban_present", Type: field.TypeBool, Default: false},
|
||||
{Name: "decryption_key", Type: field.TypeBytes, Nullable: true},
|
||||
{Name: "tick_rate", Type: field.TypeFloat64, Nullable: true},
|
||||
}
|
||||
// MatchesTable holds the schema information for the "matches" table.
|
||||
MatchesTable = &schema.Table{
|
||||
|
109
ent/mutation.go
109
ent/mutation.go
@@ -62,6 +62,8 @@ type MatchMutation struct {
|
||||
vac_present *bool
|
||||
gameban_present *bool
|
||||
decryption_key *[]byte
|
||||
tick_rate *float64
|
||||
addtick_rate *float64
|
||||
clearedFields map[string]struct{}
|
||||
stats map[int]struct{}
|
||||
removedstats map[int]struct{}
|
||||
@@ -785,6 +787,76 @@ func (m *MatchMutation) ResetDecryptionKey() {
|
||||
delete(m.clearedFields, match.FieldDecryptionKey)
|
||||
}
|
||||
|
||||
// SetTickRate sets the "tick_rate" field.
|
||||
func (m *MatchMutation) SetTickRate(f float64) {
|
||||
m.tick_rate = &f
|
||||
m.addtick_rate = nil
|
||||
}
|
||||
|
||||
// TickRate returns the value of the "tick_rate" field in the mutation.
|
||||
func (m *MatchMutation) TickRate() (r float64, exists bool) {
|
||||
v := m.tick_rate
|
||||
if v == nil {
|
||||
return
|
||||
}
|
||||
return *v, true
|
||||
}
|
||||
|
||||
// OldTickRate returns the old "tick_rate" field's value of the Match entity.
|
||||
// If the Match object wasn't provided to the builder, the object is fetched from the database.
|
||||
// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
|
||||
func (m *MatchMutation) OldTickRate(ctx context.Context) (v float64, err error) {
|
||||
if !m.op.Is(OpUpdateOne) {
|
||||
return v, errors.New("OldTickRate is only allowed on UpdateOne operations")
|
||||
}
|
||||
if m.id == nil || m.oldValue == nil {
|
||||
return v, errors.New("OldTickRate requires an ID field in the mutation")
|
||||
}
|
||||
oldValue, err := m.oldValue(ctx)
|
||||
if err != nil {
|
||||
return v, fmt.Errorf("querying old value for OldTickRate: %w", err)
|
||||
}
|
||||
return oldValue.TickRate, nil
|
||||
}
|
||||
|
||||
// AddTickRate adds f to the "tick_rate" field.
|
||||
func (m *MatchMutation) AddTickRate(f float64) {
|
||||
if m.addtick_rate != nil {
|
||||
*m.addtick_rate += f
|
||||
} else {
|
||||
m.addtick_rate = &f
|
||||
}
|
||||
}
|
||||
|
||||
// AddedTickRate returns the value that was added to the "tick_rate" field in this mutation.
|
||||
func (m *MatchMutation) AddedTickRate() (r float64, exists bool) {
|
||||
v := m.addtick_rate
|
||||
if v == nil {
|
||||
return
|
||||
}
|
||||
return *v, true
|
||||
}
|
||||
|
||||
// ClearTickRate clears the value of the "tick_rate" field.
|
||||
func (m *MatchMutation) ClearTickRate() {
|
||||
m.tick_rate = nil
|
||||
m.addtick_rate = nil
|
||||
m.clearedFields[match.FieldTickRate] = struct{}{}
|
||||
}
|
||||
|
||||
// TickRateCleared returns if the "tick_rate" field was cleared in this mutation.
|
||||
func (m *MatchMutation) TickRateCleared() bool {
|
||||
_, ok := m.clearedFields[match.FieldTickRate]
|
||||
return ok
|
||||
}
|
||||
|
||||
// ResetTickRate resets all changes to the "tick_rate" field.
|
||||
func (m *MatchMutation) ResetTickRate() {
|
||||
m.tick_rate = nil
|
||||
m.addtick_rate = nil
|
||||
delete(m.clearedFields, match.FieldTickRate)
|
||||
}
|
||||
|
||||
// AddStatIDs adds the "stats" edge to the MatchPlayer entity by ids.
|
||||
func (m *MatchMutation) AddStatIDs(ids ...int) {
|
||||
if m.stats == nil {
|
||||
@@ -912,7 +984,7 @@ func (m *MatchMutation) Type() string {
|
||||
// order to get all numeric fields that were incremented/decremented, call
|
||||
// AddedFields().
|
||||
func (m *MatchMutation) Fields() []string {
|
||||
fields := make([]string, 0, 13)
|
||||
fields := make([]string, 0, 14)
|
||||
if m.share_code != nil {
|
||||
fields = append(fields, match.FieldShareCode)
|
||||
}
|
||||
@@ -952,6 +1024,9 @@ func (m *MatchMutation) Fields() []string {
|
||||
if m.decryption_key != nil {
|
||||
fields = append(fields, match.FieldDecryptionKey)
|
||||
}
|
||||
if m.tick_rate != nil {
|
||||
fields = append(fields, match.FieldTickRate)
|
||||
}
|
||||
return fields
|
||||
}
|
||||
|
||||
@@ -986,6 +1061,8 @@ func (m *MatchMutation) Field(name string) (ent.Value, bool) {
|
||||
return m.GamebanPresent()
|
||||
case match.FieldDecryptionKey:
|
||||
return m.DecryptionKey()
|
||||
case match.FieldTickRate:
|
||||
return m.TickRate()
|
||||
}
|
||||
return nil, false
|
||||
}
|
||||
@@ -1021,6 +1098,8 @@ func (m *MatchMutation) OldField(ctx context.Context, name string) (ent.Value, e
|
||||
return m.OldGamebanPresent(ctx)
|
||||
case match.FieldDecryptionKey:
|
||||
return m.OldDecryptionKey(ctx)
|
||||
case match.FieldTickRate:
|
||||
return m.OldTickRate(ctx)
|
||||
}
|
||||
return nil, fmt.Errorf("unknown Match field %s", name)
|
||||
}
|
||||
@@ -1121,6 +1200,13 @@ func (m *MatchMutation) SetField(name string, value ent.Value) error {
|
||||
}
|
||||
m.SetDecryptionKey(v)
|
||||
return nil
|
||||
case match.FieldTickRate:
|
||||
v, ok := value.(float64)
|
||||
if !ok {
|
||||
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
||||
}
|
||||
m.SetTickRate(v)
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("unknown Match field %s", name)
|
||||
}
|
||||
@@ -1144,6 +1230,9 @@ func (m *MatchMutation) AddedFields() []string {
|
||||
if m.addmax_rounds != nil {
|
||||
fields = append(fields, match.FieldMaxRounds)
|
||||
}
|
||||
if m.addtick_rate != nil {
|
||||
fields = append(fields, match.FieldTickRate)
|
||||
}
|
||||
return fields
|
||||
}
|
||||
|
||||
@@ -1162,6 +1251,8 @@ func (m *MatchMutation) AddedField(name string) (ent.Value, bool) {
|
||||
return m.AddedMatchResult()
|
||||
case match.FieldMaxRounds:
|
||||
return m.AddedMaxRounds()
|
||||
case match.FieldTickRate:
|
||||
return m.AddedTickRate()
|
||||
}
|
||||
return nil, false
|
||||
}
|
||||
@@ -1206,6 +1297,13 @@ func (m *MatchMutation) AddField(name string, value ent.Value) error {
|
||||
}
|
||||
m.AddMaxRounds(v)
|
||||
return nil
|
||||
case match.FieldTickRate:
|
||||
v, ok := value.(float64)
|
||||
if !ok {
|
||||
return fmt.Errorf("unexpected type %T for field %s", value, name)
|
||||
}
|
||||
m.AddTickRate(v)
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("unknown Match numeric field %s", name)
|
||||
}
|
||||
@@ -1223,6 +1321,9 @@ func (m *MatchMutation) ClearedFields() []string {
|
||||
if m.FieldCleared(match.FieldDecryptionKey) {
|
||||
fields = append(fields, match.FieldDecryptionKey)
|
||||
}
|
||||
if m.FieldCleared(match.FieldTickRate) {
|
||||
fields = append(fields, match.FieldTickRate)
|
||||
}
|
||||
return fields
|
||||
}
|
||||
|
||||
@@ -1246,6 +1347,9 @@ func (m *MatchMutation) ClearField(name string) error {
|
||||
case match.FieldDecryptionKey:
|
||||
m.ClearDecryptionKey()
|
||||
return nil
|
||||
case match.FieldTickRate:
|
||||
m.ClearTickRate()
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("unknown Match nullable field %s", name)
|
||||
}
|
||||
@@ -1293,6 +1397,9 @@ func (m *MatchMutation) ResetField(name string) error {
|
||||
case match.FieldDecryptionKey:
|
||||
m.ResetDecryptionKey()
|
||||
return nil
|
||||
case match.FieldTickRate:
|
||||
m.ResetTickRate()
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("unknown Match field %s", name)
|
||||
}
|
||||
|
@@ -28,6 +28,7 @@ func (Match) Fields() []ent.Field {
|
||||
field.Bool("vac_present").Default(false),
|
||||
field.Bool("gameban_present").Default(false),
|
||||
field.Bytes("decryption_key").Optional(),
|
||||
field.Float("tick_rate").Optional(),
|
||||
}
|
||||
}
|
||||
|
||||
|
5
go.sum
5
go.sum
@@ -302,6 +302,7 @@ github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hd
|
||||
github.com/mattn/go-isatty v0.0.7/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
|
||||
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
|
||||
github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
|
||||
github.com/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/QdE+0=
|
||||
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
|
||||
github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg=
|
||||
github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc=
|
||||
@@ -332,6 +333,7 @@ github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+
|
||||
github.com/oklog/oklog v0.3.2/go.mod h1:FCV+B7mhrz4o+ueLpx+KqkyXRGMWOYEvfiXtdGtbWGs=
|
||||
github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA=
|
||||
github.com/olekukonko/tablewriter v0.0.0-20170122224234-a0225b3f23b5/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo=
|
||||
github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec=
|
||||
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
|
||||
github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
|
||||
github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk=
|
||||
@@ -410,8 +412,10 @@ github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9
|
||||
github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM=
|
||||
github.com/sony/gobreaker v0.4.1/go.mod h1:ZKptC7FHNvhBz7dN2LGjPVBz2sZJmc0/PkyDJOjmxWY=
|
||||
github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ=
|
||||
github.com/spf13/cobra v1.3.0 h1:R7cSvGu+Vv+qX0gW5R/85dx2kmmJT5z5NM8ifdYjdn0=
|
||||
github.com/spf13/pflag v1.0.1/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
|
||||
github.com/spf13/pflag v1.0.2/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
|
||||
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
|
||||
github.com/streadway/amqp v0.0.0-20190404075320-75d898a42a94/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw=
|
||||
github.com/streadway/amqp v0.0.0-20190827072141-edfb9018d271/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw=
|
||||
github.com/streadway/handy v0.0.0-20190108123426-d5acb3125c2a/go.mod h1:qNTQ5P5JnDBl6z3cMAg/SywNDC5ABu5ApDIw6lUbRmI=
|
||||
@@ -620,6 +624,7 @@ golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roY
|
||||
golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
||||
golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
||||
golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0=
|
||||
golang.org/x/tools v0.1.9-0.20211216111533-8d383106f7e7 h1:M1gcVrIb2lSn2FIL19DG0+/b8nNVKJ7W7b4WcAGZAYM=
|
||||
golang.org/x/xerrors v0.0.0-20190410155217-1f06c39b4373/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20190513163551-3ee3066db522/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
|
4
main.go
4
main.go
@@ -397,6 +397,7 @@ func getPlayer(w http.ResponseWriter, r *http.Request) {
|
||||
Parsed: iMatch.DemoParsed,
|
||||
VAC: iMatch.VacPresent,
|
||||
GameBan: iMatch.GamebanPresent,
|
||||
TickRate: iMatch.TickRate,
|
||||
}
|
||||
|
||||
tStats, err := iMatch.QueryStats().Modify(func(s *sql.Selector) {
|
||||
@@ -667,7 +668,6 @@ func getMatchChat(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
//resp := make([]*utils.ChatResponse, 0)
|
||||
resp := map[string][]*utils.ChatResponse{}
|
||||
|
||||
for _, stat := range tStats {
|
||||
@@ -846,6 +846,7 @@ func getMatches(w http.ResponseWriter, r *http.Request) {
|
||||
VAC: iMatch.VacPresent,
|
||||
GameBan: iMatch.GamebanPresent,
|
||||
AvgRank: avgRank,
|
||||
TickRate: iMatch.TickRate,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -906,6 +907,7 @@ func getMatch(w http.ResponseWriter, r *http.Request) {
|
||||
Parsed: tMatch.DemoParsed,
|
||||
Stats: []*utils.StatsResponse{},
|
||||
AvgRank: avgRank,
|
||||
TickRate: tMatch.TickRate,
|
||||
}
|
||||
|
||||
if tMatch.Date.After(time.Now().AddDate(0, 0, -1*conf.Csgowtfd.DemosExpire)) {
|
||||
|
@@ -193,6 +193,7 @@ type MatchResponse struct {
|
||||
GameBan bool `json:"game_ban"`
|
||||
Stats interface{} `json:"stats,omitempty"`
|
||||
AvgRank float64 `json:"avg_rank,omitempty"`
|
||||
TickRate float64 `json:"tick_rate,omitempty"`
|
||||
}
|
||||
|
||||
type (
|
||||
|
Reference in New Issue
Block a user