unset RelayRound.startedAt upon reset if startsAt is in the future
parent
ded25fffa0
commit
6014461860
|
@ -217,10 +217,15 @@ final class RelayApi(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
def reset(relay: RelayRound, by: User): Funit =
|
def reset(old: RelayRound, by: User): Funit =
|
||||||
studyApi.deleteAllChapters(relay.studyId, by) >>-
|
WithRelay(old.id) { relay =>
|
||||||
multiboard.invalidate(relay.studyId) >>
|
studyApi.deleteAllChapters(relay.studyId, by) >> {
|
||||||
requestPlay(relay.id, v = true)
|
old.hasStartedEarly ?? roundRepo.coll.update
|
||||||
|
.one($id(relay.id), $set("finished" -> false) ++ $unset("startedAt"))
|
||||||
|
.void
|
||||||
|
} >>-
|
||||||
|
multiboard.invalidate(relay.studyId)
|
||||||
|
} >> requestPlay(old.id, v = true)
|
||||||
|
|
||||||
def deleteRound(roundId: RelayRound.Id): Fu[Option[RelayTour]] =
|
def deleteRound(roundId: RelayRound.Id): Fu[Option[RelayTour]] =
|
||||||
byIdWithTour(roundId) flatMap {
|
byIdWithTour(roundId) flatMap {
|
||||||
|
|
|
@ -47,6 +47,7 @@ case class RelayRound(
|
||||||
)
|
)
|
||||||
|
|
||||||
def hasStarted = startedAt.isDefined
|
def hasStarted = startedAt.isDefined
|
||||||
|
def hasStartedEarly = hasStarted && startsAt.exists(_ isAfter DateTime.now)
|
||||||
def shouldHaveStarted = hasStarted || startsAt.exists(_ isBefore DateTime.now)
|
def shouldHaveStarted = hasStarted || startsAt.exists(_ isBefore DateTime.now)
|
||||||
|
|
||||||
def shouldGiveUp =
|
def shouldGiveUp =
|
||||||
|
|
Loading…
Reference in New Issue