swiss WIP
This commit is contained in:
parent
8e7939ed05
commit
a3c767863f
|
@ -34,7 +34,7 @@ object side {
|
|||
),
|
||||
if (s.settings.rated) trans.ratedTournament() else trans.casualTournament(),
|
||||
separator,
|
||||
"Swiss",
|
||||
"Swiss [BETA]",
|
||||
(isGranted(_.ManageTournament) || (ctx.userId.has(s.createdBy) && !s.isFinished)) option frag(
|
||||
" ",
|
||||
a(href := routes.Swiss.edit(s.id.value), title := "Edit tournament")(iconTag("%"))
|
||||
|
|
|
@ -77,8 +77,7 @@ final class Env(
|
|||
ResilientScheduler(
|
||||
every = Every(20 seconds),
|
||||
atMost = AtMost(15 seconds),
|
||||
// initialDelay = 20 seconds
|
||||
initialDelay = 10 seconds
|
||||
initialDelay = 20 seconds
|
||||
) { api.checkOngoingGames }
|
||||
}
|
||||
|
||||
|
|
|
@ -64,6 +64,7 @@ final private class PairingSystem(executable: String) {
|
|||
List(
|
||||
3 -> "001",
|
||||
8 -> p.number.toString,
|
||||
47 -> p.userId,
|
||||
84 -> f"${sheet.points.value}%1.1f"
|
||||
) ::: {
|
||||
val pairings = ~pairingMap.get(p.number)
|
||||
|
|
|
@ -71,23 +71,28 @@ final class SwissApi(
|
|||
cache.featuredInTeam.invalidate(swiss.teamId) inject swiss
|
||||
}
|
||||
|
||||
def update(old: Swiss, data: SwissForm.SwissData): Funit = {
|
||||
val swiss = old.copy(
|
||||
name = data.name | old.name,
|
||||
clock = data.clock,
|
||||
variant = data.realVariant,
|
||||
startsAt = data.startsAt.ifTrue(old.isCreated) | old.startsAt,
|
||||
nextRoundAt = if (old.isCreated) Some(data.startsAt | old.startsAt) else old.nextRoundAt,
|
||||
settings = old.settings.copy(
|
||||
nbRounds = data.nbRounds,
|
||||
rated = data.rated | old.settings.rated,
|
||||
description = data.description,
|
||||
hasChat = data.hasChat | old.settings.hasChat,
|
||||
roundInterval = data.roundInterval.fold(old.settings.roundInterval)(_.seconds)
|
||||
)
|
||||
)
|
||||
colls.swiss.update.one($id(swiss.id), swiss).void
|
||||
}
|
||||
def update(swiss: Swiss, data: SwissForm.SwissData): Funit =
|
||||
Sequencing(swiss.id)(byId) { old =>
|
||||
colls.swiss.update
|
||||
.one(
|
||||
$id(old.id),
|
||||
old.copy(
|
||||
name = data.name | old.name,
|
||||
clock = data.clock,
|
||||
variant = data.realVariant,
|
||||
startsAt = data.startsAt.ifTrue(old.isCreated) | old.startsAt,
|
||||
nextRoundAt = if (old.isCreated) Some(data.startsAt | old.startsAt) else old.nextRoundAt,
|
||||
settings = old.settings.copy(
|
||||
nbRounds = data.nbRounds,
|
||||
rated = data.rated | old.settings.rated,
|
||||
description = data.description,
|
||||
hasChat = data.hasChat | old.settings.hasChat,
|
||||
roundInterval = data.roundInterval.fold(old.settings.roundInterval)(_.seconds)
|
||||
)
|
||||
)
|
||||
)
|
||||
.void
|
||||
}
|
||||
|
||||
def join(id: Swiss.Id, me: User, isInTeam: TeamID => Boolean): Fu[Boolean] =
|
||||
Sequencing(id)(notFinishedById) { swiss =>
|
||||
|
|
|
@ -34,7 +34,7 @@ final class SwissForm {
|
|||
"startsAt" -> optional(inTheFuture(ISODateTimeOrTimestamp.isoDateTimeOrTimestamp)),
|
||||
"variant" -> nonEmptyText.verifying(v => Variant(v).isDefined),
|
||||
"rated" -> boolean,
|
||||
"nbRounds" -> number(min = 3, max = 50),
|
||||
"nbRounds" -> number(min = 3, max = 100),
|
||||
"description" -> optional(nonEmptyText),
|
||||
"hasChat" -> optional(boolean),
|
||||
"roundInterval" -> optional(number(min = 5, max = 3600))
|
||||
|
|
Loading…
Reference in a new issue