Skip to content

Stats Review: Add Data Types (P3) - #24715

Closed
kean wants to merge 1 commit into
review/add-module-and-infrafrom
review/stats-data-types
Closed

Stats Review: Add Data Types (P3)#24715
kean wants to merge 1 commit into
review/add-module-and-infrafrom
review/stats-data-types

Conversation

@kean

@kean kean commented Aug 5, 2025

Copy link
Copy Markdown
Contributor

This PR introduces data types:

  • DataPoint to represent points on charts (future ChartCard)
  • TopListItem and nested structs to represent types in the top lists (future TopListCard)
  • And more

The structs have localized titles, icons, etc. Some of the items have small in-memory mock data to be used in production for skeleton views (.redacted(reason: .placeholder)). It's not the same data as in #24713 (for the full-blown service that covers data over 10+ years).

@kean kean changed the title Stats Review: Add Data Types Stats Review: Add Data Types (P3) Aug 5, 2025
@kean kean mentioned this pull request Aug 5, 2025
14 tasks
@dangermattic

Copy link
Copy Markdown
Collaborator
1 Error
🚫 PR requires at least one label.
1 Warning
⚠️ This PR is larger than 500 lines of changes. Please consider splitting it into smaller PRs for easier and faster reviews.

Generated by 🚫 Danger

@sonarqubecloud

sonarqubecloud Bot commented Aug 5, 2025

Copy link
Copy Markdown


static func == (lhs: DataPoint, rhs: DataPoint) -> Bool {
lhs.date == rhs.date && lhs.value == rhs.value
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Implement hash(into:) to make Hashable align with the Equtable implementation? If two equal objects should have the same hash code.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Turns out, Hashable and Equatable is not longer needed for this type. Removed in #24760.

case comments
case posts
case timeOnSite
case bounceRate

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this bounce rate metric shown in the new Stats? If not, can it be deleted?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are supposed to be added in the near future. We've already added localizable strings and everything. I'd usually be in favor of removing the unused code, but I'd rather keep it as it's just the definitions.

}

var displayName: String {
switch sectionName.lowercased() {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the sectionName localized? If it's not localized, the displayName is also not localized (which should be). If the sectionName is localized, we should not compare it with "author" or "other".

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. I think it's OK if instead of "Authors" (the web shows it) it just says "Author". I removed localizations to keep it simple.

@kean kean closed this Aug 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants