Adds getBestX following merge from develop

This commit is contained in:
ericdecanini 2022-03-15 15:54:30 +01:00
parent 9806f1bf8f
commit 98b7d194eb
1 changed files with 5 additions and 4 deletions

View File

@ -258,9 +258,10 @@ class MessageItemFactory @Inject constructor(
): PollItem { ): PollItem {
val pollResponseSummary = informationData.pollResponseAggregatedSummary val pollResponseSummary = informationData.pollResponseAggregatedSummary
val pollState = createPollState(informationData, pollResponseSummary, pollContent) val pollState = createPollState(informationData, pollResponseSummary, pollContent)
val optionViewStates = pollContent.pollCreationInfo?.answers?.mapToOptions(pollState, informationData) val pollCreationInfo = pollContent.getBestPollCreationInfo()
val questionText = pollContent.pollCreationInfo?.question?.question.orEmpty() val questionText = pollCreationInfo?.question?.getBestQuestion().orEmpty()
val question = createPollQuestion(informationData, questionText, callback) val question = createPollQuestion(informationData, questionText, callback)
val optionViewStates = pollCreationInfo?.answers?.mapToOptions(pollState, informationData)
val totalVotesText = createTotalVotesText(pollState, pollResponseSummary) val totalVotesText = createTotalVotesText(pollState, pollResponseSummary)
return PollItem_() return PollItem_()
@ -283,7 +284,7 @@ class MessageItemFactory @Inject constructor(
): PollState = when { ): PollState = when {
!informationData.sendState.isSent() -> Sending !informationData.sendState.isSent() -> Sending
pollResponseSummary?.isClosed.orFalse() -> Ended pollResponseSummary?.isClosed.orFalse() -> Ended
pollContent.pollCreationInfo?.kind == PollType.UNDISCLOSED -> Undisclosed pollContent.getBestPollCreationInfo()?.kind == PollType.UNDISCLOSED -> Undisclosed
pollResponseSummary?.myVote?.isNotEmpty().orFalse() -> Voted(pollResponseSummary?.totalVotes ?: 0) pollResponseSummary?.myVote?.isNotEmpty().orFalse() -> Voted(pollResponseSummary?.totalVotes ?: 0)
else -> Ready else -> Ready
} }
@ -295,7 +296,7 @@ class MessageItemFactory @Inject constructor(
val pollResponseSummary = informationData.pollResponseAggregatedSummary val pollResponseSummary = informationData.pollResponseAggregatedSummary
val winnerVoteCount = pollResponseSummary?.winnerVoteCount val winnerVoteCount = pollResponseSummary?.winnerVoteCount
val optionId = answer.id ?: "" val optionId = answer.id ?: ""
val optionAnswer = answer.answer ?: "" val optionAnswer = answer.getBestAnswer() ?: ""
val voteSummary = pollResponseSummary?.votes?.get(answer.id) val voteSummary = pollResponseSummary?.votes?.get(answer.id)
val voteCount = voteSummary?.total ?: 0 val voteCount = voteSummary?.total ?: 0
val votePercentage = voteSummary?.percentage ?: 0.0 val votePercentage = voteSummary?.percentage ?: 0.0