fixed wrong addDate logic
This commit is contained in:
18
main.go
18
main.go
@@ -81,19 +81,17 @@ func housekeeping() {
|
||||
}
|
||||
|
||||
for _, bp := range bPlayers {
|
||||
qMatch := db.Match.Update().Where(match.HasPlayersWith(player.ID(bp.ID)))
|
||||
|
||||
if !bp.GameBanDate.IsZero() {
|
||||
qMatch.Where(match.DateLTE(bp.GameBanDate.AddDate(0, 0, -30))).SetGamebanPresent(true)
|
||||
err := db.Match.Update().Where(match.And(match.HasPlayersWith(player.ID(bp.ID)), match.DateLTE(bp.GameBanDate.AddDate(0, 0, 30)))).SetGamebanPresent(true).Exec(context.Background())
|
||||
if err != nil {
|
||||
log.Warningf("[HK] Unable to set gameban/vac for match: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
if !bp.VacDate.IsZero() {
|
||||
qMatch.Where(match.DateLTE(bp.VacDate.AddDate(0, 0, -30))).SetVacPresent(true)
|
||||
}
|
||||
|
||||
err := qMatch.Exec(context.Background())
|
||||
if err != nil {
|
||||
log.Warningf("[HK] Unable to query for banned players matches: %v", err)
|
||||
err := db.Match.Update().Where(match.And(match.HasPlayersWith(player.ID(bp.ID)), match.DateLTE(bp.VacDate.AddDate(0, 0, 30)))).SetVacPresent(true).Exec(context.Background())
|
||||
if err != nil {
|
||||
log.Warningf("[HK] Unable to set gameban/vac for match: %v", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user