Fix channel stats overview

This commit is contained in:
Ilya Laktyushin 2023-12-18 17:19:24 +04:00
parent 595dfd18c5
commit 857f508dea

View File

@ -483,7 +483,7 @@ class StatsOverviewItemNode: ListViewItemNode {
(sharesPerPostDelta.text, sharesPerPostDelta.positive ? .positive : .negative)
)
}
if stats.reactionsPerPost.current > 0 || reactionsPerStoryDelta.hasValue {
if stats.reactionsPerPost.current > 0 || reactionsPerPostDelta.hasValue {
let index = hasStories ? 4 : 2
items[index] = (
compactNumericCountString(Int(stats.reactionsPerPost.current)),
@ -492,17 +492,20 @@ class StatsOverviewItemNode: ListViewItemNode {
)
}
if hasStories {
items[1] = (
let index = items[0] == nil ? 0 : 1
items[index] = (
compactNumericCountString(Int(stats.viewsPerStory.current)),
item.presentationData.strings.Stats_ViewsPerStory,
(viewsPerStoryDelta.text, viewsPerStoryDelta.positive ? .positive : .negative)
)
items[3] = (
let sharesIndex = items[1] == nil ? 1 : 3
items[sharesIndex] = (
compactNumericCountString(Int(stats.sharesPerStory.current)),
item.presentationData.strings.Stats_SharesPerStory,
(sharesPerStoryDelta.text, sharesPerStoryDelta.positive ? .positive : .negative)
)
items[5] = (
let reactionsIndex = items[3] == nil ? 2 : 5
items[reactionsIndex] = (
compactNumericCountString(Int(stats.reactionsPerStory.current)),
item.presentationData.strings.Stats_ReactionsPerStory,
(reactionsPerStoryDelta.text, reactionsPerStoryDelta.positive ? .positive : .negative)