Skip to content

Commit

Permalink
relay.finishedAt
Browse files Browse the repository at this point in the history
  • Loading branch information
ornicar committed Nov 17, 2024
1 parent e1370e2 commit 4c2b0fe
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions src/main/scala/RelayCrowd.scala
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,23 @@ final private class RelayCrowd(roomCrowd: RoomCrowd, mongo: Mongo)(using ex: Exe
"pipeline" -> List(
BSONDocument(
"$match" -> BSONDocument(
"finished" -> false,
"$expr" -> BSONDocument("$eq" -> BSONArray("$tourId", "$$tourId"))
"$expr" -> BSONDocument(
"$and" ->
BSONArray(
BSONDocument(
BSONDocument("$eq" -> BSONArray("$tourId", "$$tourId")),
"$or" -> BSONArray(
BSONDocument("$exists" -> BSONArray("$finishedAt", false)),
BSONDocument(
"$gt" -> BSONArray(
"$finishedAt",
BSONDateTime(nowMillis - 1000 * 60 * 60 * 2) // 2 hours
)
)
)
)
)
)
)
),
BSONDocument("$sort" -> BSONDocument("createdAt" -> 1)),
Expand Down

0 comments on commit 4c2b0fe

Please sign in to comment.