Skip to content

Commit

Permalink
Merge pull request #11 from zsoltk/limit-1-participant-per-puzzle
Browse files Browse the repository at this point in the history
Limit one participant per puzzle
  • Loading branch information
zsoltk authored Oct 2, 2023
2 parents 4075156 + 43e325e commit 5c35555
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions shared/src/commonMain/kotlin/com/bumble/puzzyx/model/Entries.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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!")
}
}

0 comments on commit 5c35555

Please sign in to comment.