convert "votes" map

see https://github.com/nextcloud/spreed/pull/7500

Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
This commit is contained in:
Marcel Hibbe 2022-06-30 10:03:15 +02:00 committed by Andy Scherzinger (Rebase PR Action)
parent 73d48a395c
commit 01f7016ae2

View File

@ -123,7 +123,7 @@ class PollRepositoryImpl(private val ncApi: NcApi, private val currentUserProvid
pollResponse.id,
pollResponse.question,
pollResponse.options,
pollResponse.votes,
convertVotes(pollResponse.votes),
pollResponse.actorType,
pollResponse.actorId,
pollResponse.actorDisplayName,
@ -137,6 +137,14 @@ class PollRepositoryImpl(private val ncApi: NcApi, private val currentUserProvid
return poll
}
private fun convertVotes(votes: Map<String, Int>?): Map<String, Int> {
val resultMap: MutableMap<String, Int> = HashMap()
votes?.forEach {
resultMap[it.key.replace("option-", "")] = it.value
}
return resultMap
}
private fun mapToPollDetails(pollDetailsResponse: PollDetailsResponse): PollDetails {
return PollDetails(
pollDetailsResponse.actorType,