only auto-analyse broadcast games with 10+ moves

pull/8444/head
Thibault Duplessis 2021-03-21 08:37:48 +01:00
parent 53b5f272f7
commit 57b3b99591
1 changed files with 7 additions and 6 deletions

View File

@ -127,18 +127,19 @@ final private class RelaySync(
tags = chapterNewTags
)(actorApi.Who(chapter.ownerId, sri)) >> {
val newEnd = chapter.tags.resultColor.isEmpty && tags.resultColor.isDefined
newEnd ?? onChapterEnd(study, chapter.id)
newEnd ?? onChapterEnd(study, chapter)
}
}
}
private def onChapterEnd(study: Study, chapterId: Chapter.Id): Funit =
chapterRepo.setRelayPath(chapterId, Path.root) >>
studyApi.analysisRequest(
private def onChapterEnd(study: Study, chapter: Chapter): Funit =
chapterRepo.setRelayPath(chapter.id, Path.root) >> {
(chapter.root.mainline.sizeIs > 10) ?? studyApi.analysisRequest(
studyId = study.id,
chapterId = chapterId,
chapterId = chapter.id,
userId = study.ownerId
) >>- studyApi.reloadChapters(study)
)
} >>- studyApi.reloadChapters(study)
private def createChapter(study: Study, game: RelayGame): Fu[Chapter] =
chapterRepo.nextOrderByStudy(study.id) flatMap { order =>