diff --git a/Mastodon/Scene/Share/View/Content/PollOptionView+Configuration.swift b/Mastodon/Scene/Share/View/Content/PollOptionView+Configuration.swift index 334c9ce15..cbc7c61f8 100644 --- a/Mastodon/Scene/Share/View/Content/PollOptionView+Configuration.swift +++ b/Mastodon/Scene/Share/View/Content/PollOptionView+Configuration.swift @@ -33,12 +33,12 @@ extension PollOptionView { .store(in: &disposeBag) // percentage Publishers.CombineLatest( - option.poll.publisher(for: \.votesCount), + option.poll.publisher(for: \.votersCount), option.publisher(for: \.votesCount) ) - .map { pollVotesCount, optionVotesCount -> Double? in - guard pollVotesCount > 0, optionVotesCount >= 0 else { return 0 } - return Double(optionVotesCount) / Double(pollVotesCount) + .map { pollVotersCount, optionVotesCount -> Double? in + guard pollVotersCount > 0, optionVotesCount >= 0 else { return 0 } + return Double(optionVotesCount) / Double(pollVotersCount) } .assign(to: \.percentage, on: viewModel) .store(in: &disposeBag) diff --git a/MastodonSDK/Sources/MastodonUI/View/Content/PollOptionView+ViewModel.swift b/MastodonSDK/Sources/MastodonUI/View/Content/PollOptionView+ViewModel.swift index a91f57dc2..e3e34d1cb 100644 --- a/MastodonSDK/Sources/MastodonUI/View/Content/PollOptionView+ViewModel.swift +++ b/MastodonSDK/Sources/MastodonUI/View/Content/PollOptionView+ViewModel.swift @@ -175,7 +175,7 @@ extension PollOptionView.ViewModel { view.voteProgressStripView.setProgress(0.0, animated: false) case .reveal(let voted, let percentage, let animating): view.optionPercentageLabel.isHidden = false - view.optionPercentageLabel.text = String(Int(100 * percentage)) + "%" + view.optionPercentageLabel.text = String(Int(round(100 * percentage))) + "%" view.voteProgressStripView.isHidden = false view.voteProgressStripView.tintColor = voted ? self.primaryStripProgressViewTintColor : self.secondaryStripProgressViewTintColor view.voteProgressStripView.setProgress(CGFloat(percentage), animated: animating)