From 43e325efc6966ec80c8c9b829c307cc61954fd9a Mon Sep 17 00:00:00 2001 From: Zsolt Kocsi Date: Fri, 29 Sep 2023 19:55:35 +0100 Subject: [PATCH] Limit one participant / puzzle --- .../kotlin/com/bumble/puzzyx/model/Entries.kt | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/shared/src/commonMain/kotlin/com/bumble/puzzyx/model/Entries.kt b/shared/src/commonMain/kotlin/com/bumble/puzzyx/model/Entries.kt index a68547aa..185d4252 100644 --- a/shared/src/commonMain/kotlin/com/bumble/puzzyx/model/Entries.kt +++ b/shared/src/commonMain/kotlin/com/bumble/puzzyx/model/Entries.kt @@ -94,7 +94,7 @@ val entries = listOf( ), Entry.ComposableContent( puzzle = Puzzle.PUZZLE1, - githubUserName = "codeWhizKid", + githubUserName = "pixelPirate", content = { val infiniteTransition = rememberInfiniteTransition() val color by infiniteTransition.animateColor( @@ -117,6 +117,11 @@ val entries = listOf( val puzzle1Entries = entries .filter { it.puzzle == Puzzle.PUZZLE1 } - .also { if (it.size > Puzzle.PUZZLE1.maxEntryCount) - error("This puzzle is already filled up. Add your entry to another one!") + .also { + if (it.size > Puzzle.PUZZLE1.maxEntryCount) + error("This puzzle is already filled up. Add your entry to another one!") + + if (it.map { it.githubUserName }.distinct().size < it.size) { + error("One entry per puzzle is the limit, but you can try again in the next one!") + } }