Skip to content

Commit

Permalink
#725 filter empty extrateams
Browse files Browse the repository at this point in the history
  • Loading branch information
luechtdiode committed Oct 6, 2023
1 parent 0f8c854 commit e7d56b8
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/main/scala/ch/seidel/kutu/http/RegistrationRoutes.scala
Original file line number Diff line number Diff line change
Expand Up @@ -379,13 +379,16 @@ trait RegistrationRoutes extends SprayJsonSupport with JwtSupport with JsonSuppo
val regs = selectAthletRegistrations(registrationId)
val vereinTeams = regs
.flatMap(_.team)
.filter(_ > 0)
.distinct
.sorted

val nextVereinTeam = if (vereinTeams.isEmpty) 1 else vereinTeams.max + 1

(1 to nextVereinTeam).toList.map(idx => TeamItem(idx, registration.toVerein.extendedprint)) :::
wi.wettkampf.toWettkampf.extraTeams.zipWithIndex.map(item => TeamItem(item._2 * -1 - 1, item._1))
wi.wettkampf.toWettkampf.extraTeams
.filter(_.nonEmpty)
.zipWithIndex.map(item => TeamItem(item._2 * -1 - 1, item._1))
}
}
}
Expand Down

0 comments on commit e7d56b8

Please sign in to comment.