Provide allocated seat numbers in result

This commit is contained in:
2023-08-06 16:28:07 +02:00
parent 3601e0570d
commit 3b1fb167dc
3 changed files with 8 additions and 3 deletions
@@ -2,4 +2,5 @@ package de.twomartens.wahlrecht.model.dto.v1
data class ElectedCandidates(val overallResult: ElectedResult, data class ElectedCandidates(val overallResult: ElectedResult,
val constituencyResults: Map<Int, ElectedResult>, val constituencyResults: Map<Int, ElectedResult>,
val electionNumbersForSeatAllocation: List<Double>) val electionNumbersForSeatAllocation: List<Double>,
val seatAllocation: Map<String, Int>)
@@ -2,4 +2,5 @@ package de.twomartens.wahlrecht.model.internal
data class ElectedCandidates(val overallResult: ElectedResult, data class ElectedCandidates(val overallResult: ElectedResult,
val constituencyResults: Map<Int, ElectedResult>, val constituencyResults: Map<Int, ElectedResult>,
val electionNumbersForSeatAllocation: List<Double>) val electionNumbersForSeatAllocation: List<Double>,
val seatAllocation: Map<String, Int>)
@@ -51,7 +51,10 @@ class CalculationService(
return ElectedCandidates( return ElectedCandidates(
overallResult = overallElectedCandidates, overallResult = overallElectedCandidates,
constituencyResults = constituencyResults, constituencyResults = constituencyResults,
electionNumbersForSeatAllocation = seatResult.usedElectionNumbers electionNumbersForSeatAllocation = seatResult.usedElectionNumbers,
seatAllocation = seatResult.seatsPerNomination
.map { Pair(it.key.partyAbbreviation, it.value) }
.toMap()
) )
} }