This repository was archived by the owner on Sep 15, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +5
-5
lines changed
Sources/WordPressKit/Models/Stats/Insights Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -35,11 +35,11 @@ extension StatsAllTimesInsight: StatsInsightData {
3535 let rootContainer = try decoder. container ( keyedBy: RootKeys . self)
3636 let container = try rootContainer. nestedContainer ( keyedBy: CodingKeys . self, forKey: . stats)
3737
38- self . postsCount = try container. decodeIfPresent ( Int . self, forKey: . postsCount) ?? 0
39- self . bestViewsPerDayCount = try container. decode ( Int . self, forKey: . bestViewsPerDayCount)
40- self . visitorsCount = try container. decodeIfPresent ( Int . self, forKey: . visitorsCount) ?? 0
38+ self . postsCount = ( try ? container. decodeIfPresent ( Int . self, forKey: . postsCount) ) ?? 0
39+ self . bestViewsPerDayCount = ( try ? container. decodeIfPresent ( Int . self, forKey: . bestViewsPerDayCount) ) ?? 0
40+ self . visitorsCount = ( try ? container. decodeIfPresent ( Int . self, forKey: . visitorsCount) ) ?? 0
4141
42- self . viewsCount = try container. decodeIfPresent ( Int . self, forKey: . viewsCount) ?? 0
42+ self . viewsCount = ( try ? container. decodeIfPresent ( Int . self, forKey: . viewsCount) ) ?? 0
4343 let bestViewsDayString = try container. decodeIfPresent ( String . self, forKey: . bestViewsDay) ?? " "
4444 self . bestViewsDay = StatsAllTimesInsight . dateFormatter. date ( from: bestViewsDayString) ?? Date ( )
4545 }
Original file line number Diff line number Diff line change @@ -47,7 +47,7 @@ extension StatsTagAndCategory {
4747 let container = try decoder. container ( keyedBy: CodingKeys . self)
4848
4949 let innerTags = try container. decodeIfPresent ( [ StatsTagAndCategory ] . self, forKey: . children) ?? [ ]
50- let viewsCount = try container. decodeIfPresent ( Int . self, forKey: . viewsCount)
50+ let viewsCount = ( try ? container. decodeIfPresent ( Int . self, forKey: . viewsCount) ) ?? 0
5151
5252 // This gets kinda complicated. The API collects some tags/categories
5353 // into groups, and we have to handle that.
You can’t perform that action at this time.
0 commit comments