From 045dab17dbf42938177f8d7592fda6cbfee1b2ed Mon Sep 17 00:00:00 2001 From: Trevor Bayless Date: Thu, 7 Sep 2023 15:42:33 -0500 Subject: [PATCH 1/2] Update draw query --- modules/game/src/main/Query.scala | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/game/src/main/Query.scala b/modules/game/src/main/Query.scala index a46cded2d40f..d9bf9a65e424 100644 --- a/modules/game/src/main/Query.scala +++ b/modules/game/src/main/Query.scala @@ -26,7 +26,10 @@ object Query: val mate: Bdoc = status(Status.Mate) - def draw(u: UserId): Bdoc = user(u) ++ finished ++ F.winnerId.$exists(false) + def draw(u: UserId): Bdoc = + user(u) ++ finished ++ F.winnerId.$exists(false) ++ $doc( + F.status $in List(Status.Stalemate.id, Status.Draw.id) + ) val finished: Bdoc = F.status $gte Status.Mate.id From a407dc57579f460ad0f6a827901964b0a20dd39f Mon Sep 17 00:00:00 2001 From: Trevor Bayless Date: Sat, 27 Jan 2024 13:43:57 -0600 Subject: [PATCH 2/2] Remove finished condition --- modules/game/src/main/Query.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/game/src/main/Query.scala b/modules/game/src/main/Query.scala index d9bf9a65e424..14d08cc7142f 100644 --- a/modules/game/src/main/Query.scala +++ b/modules/game/src/main/Query.scala @@ -27,7 +27,7 @@ object Query: val mate: Bdoc = status(Status.Mate) def draw(u: UserId): Bdoc = - user(u) ++ finished ++ F.winnerId.$exists(false) ++ $doc( + user(u) ++ F.winnerId.$exists(false) ++ $doc( F.status $in List(Status.Stalemate.id, Status.Draw.id) )