fixed match win/loss/ties
This commit is contained in:
@@ -74,9 +74,9 @@ func (p *DemoParser) downloadReplay(demo *Demo) (io.Reader, error) {
|
||||
func (p *DemoParser) getDBPlayer(demo *Demo, demoPlayer *common.Player) (*ent.Stats, error) {
|
||||
p.lock.RLock()
|
||||
tMatchPlayer, err := p.db.Stats.Query().WithMatches(func(q *ent.MatchQuery) {
|
||||
q.Where(match.MatchID(demo.MatchId))
|
||||
q.Where(match.ID(demo.MatchId))
|
||||
}).WithPlayers(func(q *ent.PlayerQuery) {
|
||||
q.Where(player.Steamid(demoPlayer.SteamID64))
|
||||
q.Where(player.ID(demoPlayer.SteamID64))
|
||||
}).Only(context.Background())
|
||||
p.lock.RUnlock()
|
||||
if err != nil {
|
||||
@@ -93,7 +93,7 @@ func (p *DemoParser) getMatchPlayerBySteamID(stats []*ent.Stats, steamId uint64)
|
||||
log.Errorf("Unbale to get Stats from statList: %v", err)
|
||||
return nil
|
||||
}
|
||||
if tPLayer.Steamid == steamId {
|
||||
if tPLayer.ID == steamId {
|
||||
return tStats
|
||||
}
|
||||
}
|
||||
@@ -111,7 +111,7 @@ func (p *DemoParser) parseWorker() {
|
||||
}
|
||||
|
||||
p.lock.RLock()
|
||||
tMatch, err := p.db.Match.Query().Where(match.MatchID(demo.MatchId)).Only(context.Background())
|
||||
tMatch, err := p.db.Match.Query().Where(match.ID(demo.MatchId)).Only(context.Background())
|
||||
p.lock.RUnlock()
|
||||
if err != nil {
|
||||
log.Errorf("[DP] Unable to get match %d: %v", demo.MatchId, err)
|
||||
@@ -313,7 +313,7 @@ func (p *DemoParser) parseWorker() {
|
||||
err := tMatchPlayer.Update().SetExtended(tMatchPlayer.Extended).Exec(context.Background())
|
||||
p.lock.Unlock()
|
||||
if err != nil {
|
||||
log.Errorf("[DP] Unable to update player %d in database: %v", tMatchPlayer.Edges.Players.Steamid, err)
|
||||
log.Errorf("[DP] Unable to update player %d in database: %v", tMatchPlayer.Edges.Players.ID, err)
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user