reset chapter relay path on game end
parent
9121d31a15
commit
f709fdb58c
|
@ -113,15 +113,19 @@ private final class RelaySync(
|
|||
tags = chapterNewTags,
|
||||
uid = socketUid
|
||||
) >> {
|
||||
chapterNewTags.resultColor.isDefined ?? studyApi.analysisRequest(
|
||||
studyId = study.id,
|
||||
chapterId = chapter.id,
|
||||
userId = "lichess"
|
||||
)
|
||||
chapterNewTags.resultColor.isDefined ?? onChapterEnd(study.id, chapter.id)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private def onChapterEnd(studyId: Study.Id, chapterId: Chapter.Id): Funit =
|
||||
chapterRepo.setRelayPath(chapterId, Path.root) >>
|
||||
studyApi.analysisRequest(
|
||||
studyId = studyId,
|
||||
chapterId = chapterId,
|
||||
userId = "lichess"
|
||||
)
|
||||
|
||||
private def createChapter(study: Study, game: RelayGame): Fu[Chapter] =
|
||||
chapterRepo.nextOrderByStudy(study.id) flatMap { order =>
|
||||
val name = {
|
||||
|
|
|
@ -71,6 +71,9 @@ final class ChapterRepo(coll: Coll) {
|
|||
def setRelay(chapterId: Chapter.Id, relay: Chapter.Relay) =
|
||||
coll.updateField($id(chapterId), "relay", relay).void
|
||||
|
||||
def setRelayPath(chapterId: Chapter.Id, path: Path) =
|
||||
coll.updateField($id(chapterId), "relay.path", path).void
|
||||
|
||||
def setTagsFor(chapter: Chapter) =
|
||||
coll.updateField($id(chapter.id), "tags", chapter.tags).void
|
||||
|
||||
|
|
Loading…
Reference in New Issue