Skip to content

Commit

Permalink
Merge pull request #18104 from wordpress-mobile/issue-17904-insights-…
Browse files Browse the repository at this point in the history
…cards-not-showing

Fix ghost not disappearing from Insights cards in certain conditions
  • Loading branch information
Gio2018 authored Mar 11, 2022
2 parents d328080 + 8b3822e commit 27108ee
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions WordPress/Classes/Stores/StatsInsightsStore.swift
Original file line number Diff line number Diff line change
Expand Up @@ -463,18 +463,28 @@ private extension StatsInsightsStore {

transaction { state in
state.lastPostInsight = StatsRecord.insight(for: blog, type: .lastPostInsight).flatMap { StatsLastPostInsight(statsRecordValues: $0.recordValues) }
state.lastPostSummaryStatus = state.lastPostInsight == nil ? .error : .success
state.allTimeStats = StatsRecord.insight(for: blog, type: .allTimeStatsInsight).flatMap { StatsAllTimesInsight(statsRecordValues: $0.recordValues) }
state.allTimeStatus = state.allTimeStats == nil ? .error : .success
state.annualAndMostPopularTime = StatsRecord.insight(for: blog, type: .annualAndMostPopularTimes).flatMap { StatsAnnualAndMostPopularTimeInsight(statsRecordValues: $0.recordValues) }
state.annualAndMostPopularTimeStatus = state.annualAndMostPopularTime != nil ? .error : .success
state.publicizeFollowers = StatsRecord.insight(for: blog, type: .publicizeConnection).flatMap { StatsPublicizeInsight(statsRecordValues: $0.recordValues) }
state.publicizeFollowersStatus = state.publicizeFollowers == nil ? .error : .success
state.todaysStats = StatsRecord.insight(for: blog, type: .today).flatMap { StatsTodayInsight(statsRecordValues: $0.recordValues) }
state.todaysStatsStatus = state.todaysStats == nil ? .error : .success
state.postingActivity = StatsRecord.insight(for: blog, type: .streakInsight).flatMap { StatsPostingStreakInsight(statsRecordValues: $0.recordValues) }
state.postingActivityStatus = state.postingActivity == nil ? .error : .success
state.topTagsAndCategories = StatsRecord.insight(for: blog, type: .tagsAndCategories).flatMap { StatsTagsAndCategoriesInsight(statsRecordValues: $0.recordValues) }
state.tagsAndCategoriesStatus = state.topTagsAndCategories == nil ? .error : .success
state.topCommentsInsight = StatsRecord.insight(for: blog, type: .commentInsight).flatMap { StatsCommentsInsight(statsRecordValues: $0.recordValues) }
state.commentsInsightStatus = state.topCommentsInsight == nil ? .error : .success

let followersInsight = StatsRecord.insight(for: blog, type: .followers)

state.dotComFollowers = followersInsight.flatMap { StatsDotComFollowersInsight(statsRecordValues: $0.recordValues) }
state.dotComFollowersStatus = state.dotComFollowers == nil ? .error : .success
state.emailFollowers = followersInsight.flatMap { StatsEmailFollowersInsight(statsRecordValues: $0.recordValues) }
state.emailFollowersStatus = state.emailFollowers == nil ? .error : .success
}

DDLogInfo("Insights load from cache")
Expand Down

0 comments on commit 27108ee

Please sign in to comment.