Skip to content

Commit

Permalink
fix timecontrol regexp
Browse files Browse the repository at this point in the history
  • Loading branch information
yafred committed Mar 9, 2021
1 parent 348e6f6 commit e8f276a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion internal/server/nextmoves.go
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ func processGameFilter(filter GameFilter) bson.M {
} else {
timecontrolParts := strings.Split(strings.TrimSpace(timeControl), "+")
exactQuery := bson.M{"timecontrol": timecontrolParts[0]}
looseQuery := bson.M{"timecontrol": bson.M{"$regex": regexp.QuoteMeta("^" + timecontrolParts[0] + "+")}}
looseQuery := bson.M{"timecontrol": bson.M{"$regex": "^" + regexp.QuoteMeta(timecontrolParts[0]+"+")}}
orQuery = append(orQuery, exactQuery, looseQuery)
}
timeControlBson = append(timeControlBson, bson.M{"$or": orQuery})
Expand Down

0 comments on commit e8f276a

Please sign in to comment.