[FEATURE] Detailed stats about player weapon usage and hitgroups (#1)

Reviewed-on: https://git.harting.dev/CSGOWTF/csgowtfd/pulls/1
Co-authored-by: Giovanni Harting <539@idlegandalf.com>
Co-committed-by: Giovanni Harting <539@idlegandalf.com>
This commit is contained in:
2021-10-16 01:49:52 +02:00
parent 3ff65bc5d7
commit 99ec0ad1bc
37 changed files with 15185 additions and 1080 deletions

View File

@@ -423,7 +423,6 @@ func (mq *MatchQuery) sqlAll(ctx context.Context) ([]*Match, error) {
nodeids[nodes[i].ID] = nodes[i]
nodes[i].Edges.Stats = []*Stats{}
}
query.withFKs = true
query.Where(predicate.Stats(func(s *sql.Selector) {
s.Where(sql.InValues(match.StatsColumn, fks...))
}))
@@ -432,13 +431,10 @@ func (mq *MatchQuery) sqlAll(ctx context.Context) ([]*Match, error) {
return nil, err
}
for _, n := range neighbors {
fk := n.match_stats
if fk == nil {
return nil, fmt.Errorf(`foreign-key "match_stats" is nil for node %v`, n.ID)
}
node, ok := nodeids[*fk]
fk := n.MatchStats
node, ok := nodeids[fk]
if !ok {
return nil, fmt.Errorf(`unexpected foreign-key "match_stats" returned %v for node %v`, *fk, n.ID)
return nil, fmt.Errorf(`unexpected foreign-key "match_stats" returned %v for node %v`, fk, n.ID)
}
node.Edges.Stats = append(node.Edges.Stats, n)
}