Renaming field in PollResponseData for better clarity

This commit is contained in:
Maxime NATUREL 2023-01-12 10:14:47 +01:00
parent 94dd599f13
commit d1ce15bf18
4 changed files with 6 additions and 6 deletions

View file

@ -83,7 +83,7 @@ class PollItemViewStateFactory @Inject constructor(
totalVotes: Int,
winnerVoteCount: Int?,
): PollViewState {
val totalVotesText = if (pollResponseSummary?.hasDecryptionError.orFalse()) {
val totalVotesText = if (pollResponseSummary?.hasEncryptedRelatedEvents.orFalse()) {
stringProvider.getString(R.string.unable_to_decrypt_some_events_in_poll)
} else {
stringProvider.getQuantityString(R.plurals.poll_total_vote_count_after_ended, totalVotes, totalVotes)
@ -131,7 +131,7 @@ class PollItemViewStateFactory @Inject constructor(
pollResponseSummary: PollResponseData?,
totalVotes: Int
): PollViewState {
val totalVotesText = if (pollResponseSummary?.hasDecryptionError.orFalse()) {
val totalVotesText = if (pollResponseSummary?.hasEncryptedRelatedEvents.orFalse()) {
stringProvider.getString(R.string.unable_to_decrypt_some_events_in_poll)
} else {
stringProvider.getQuantityString(R.plurals.poll_total_vote_count_before_ended_and_voted, totalVotes, totalVotes)

View file

@ -45,7 +45,7 @@ class PollResponseDataFactory @Inject constructor(
},
winnerVoteCount = it.aggregatedContent?.winnerVoteCount ?: 0,
totalVotes = it.aggregatedContent?.totalVotes ?: 0,
hasDecryptionError = it.encryptedRelatedEventIds.isNotEmpty(),
hasEncryptedRelatedEvents = it.encryptedRelatedEventIds.isNotEmpty(),
)
}
}

View file

@ -91,7 +91,7 @@ data class PollResponseData(
val totalVotes: Int = 0,
val winnerVoteCount: Int = 0,
val isClosed: Boolean = false,
val hasDecryptionError: Boolean = false,
val hasEncryptedRelatedEvents: Boolean = false,
) : Parcelable {
fun getVoteSummaryOfAnOption(optionId: String) = votes?.get(optionId)

View file

@ -136,7 +136,7 @@ class PollItemViewStateFactoryTest {
// Given
val stringProvider = FakeStringProvider()
val pollItemViewStateFactory = PollItemViewStateFactory(stringProvider.instance)
val closedPollSummary = A_POLL_RESPONSE_DATA.copy(isClosed = true, hasDecryptionError = true)
val closedPollSummary = A_POLL_RESPONSE_DATA.copy(isClosed = true, hasEncryptedRelatedEvents = true)
val closedPollInformationData = A_MESSAGE_INFORMATION_DATA.copy(pollResponseAggregatedSummary = closedPollSummary)
// When
@ -220,7 +220,7 @@ class PollItemViewStateFactoryTest {
totalVotes = 1,
myVote = A_POLL_OPTION_IDS[0],
votes = mapOf(A_POLL_OPTION_IDS[0] to PollVoteSummaryData(total = 1, percentage = 1.0)),
hasDecryptionError = true,
hasEncryptedRelatedEvents = true,
)
val disclosedPollContent = A_POLL_CONTENT.copy(
unstablePollCreationInfo = A_POLL_CONTENT.getBestPollCreationInfo()?.copy(