Skip to content

PM-4620 general statistics - #126

Merged
vas3a merged 2 commits into
developfrom
PM-4620_general-statistics
Aug 11, 2026
Merged

PM-4620 general statistics#126
vas3a merged 2 commits into
developfrom
PM-4620_general-statistics

Conversation

@vas3a

@vas3a vas3a commented Aug 11, 2026

Copy link
Copy Markdown
Collaborator

This pull request adds two new country-level statistics reports—"Country Member Details" and "Top Winners by Country"—and implements their backend logic, SQL queries, and API endpoints. It also updates the report directory and test coverage to include these new reports. The key changes are grouped below:

New Reports and Directory Integration:

  • Added "Country Member Details" and "Top Winners by Country" reports to the registered reports directory and made them available in the statistics section. [1] [2]
  • Updated tests to verify the presence of these new reports in the accessible reports directory.

SQL Query Additions and Improvements:

  • Added country-member-details.sql and top-winners-by-country.sql to compute, respectively, member/skill/top-winner breakdowns by country and the top three winners per country, using enhanced logic for accurate aggregation and normalization. [1] [2]
  • Refactored first-place-by-country.sql to use consistent aggregation logic with the new reports. [1] [2]

Backend Logic and API Endpoints:

  • Implemented getCountryMemberDetails and getTopWinnersByCountry methods in GeneralStatisticsService to normalize, aggregate, and return the new report data with country names, member counts, skill breakdowns, and top winner details. [1] [2] [3]
  • Added corresponding API endpoints to StatisticsGeneralController for accessing the new reports.

Testing Enhancements:

  • Added comprehensive tests for data normalization, aggregation, and edge cases for the new service methods in general-statistics.service.spec.ts.

These changes collectively provide richer, more detailed country-level statistics and make them accessible through both the UI and API.

@vas3a
vas3a requested a balanced review from Copilot August 11, 2026 05:14

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR (PM-4620) adds two new country-level statistics reports—"Country Member Details" and "Top Winners by Country"—to the reports API. It wires each report end-to-end through the standard pattern (SQL file → service method → controller endpoint → report directory entry) and refactors the existing first-place-by-country.sql so all three reports derive "wins" from members."memberStats"/memberStatsHistory filtered to relevant tracks, replacing the prior reviews.submission-based logic.

Changes:

  • Add country-member-details.sql and top-winners-by-country.sql, plus getCountryMemberDetails/getTopWinnersByCountry service methods that normalize, merge (by resolved country name), and rank the results.
  • Refactor first-place-by-country.sql to the shared memberStats win-aggregation logic and switch country attribution to prefer competitionCountryCode over homeCountryCode.
  • Register both reports in the directory and add service and SQL structural tests.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.

Show a summary per file
File Description
sql/reports/statistics/general/country-member-details.sql New query: per-country member counts, owned-skill counts, and top-3 winners.
sql/reports/statistics/general/top-winners-by-country.sql New query: per-country total wins with deterministic top-3 winners as JSONB.
sql/reports/statistics/general/first-place-by-country.sql Refactored to memberStats-based win aggregation and new country-code precedence.
src/statistics/general-statistics.service.ts Adds two methods that normalize/merge/rank the new report rows.
src/statistics/statistics-general.controller.ts Adds two @Get endpoints for the new reports.
src/reports/report-directory.data.ts Registers the two new public reports.
src/statistics/general-statistics.service.spec.ts New unit tests for normalization, merging, and empty-data defaults.
src/statistics/statistics-general.sql.spec.ts New structural assertions over the three SQL files.
src/reports/report-directory.data.spec.ts Asserts the new reports appear in the accessible directory.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@vas3a
vas3a merged commit 755d7af into develop Aug 11, 2026
6 checks passed
@vas3a
vas3a deleted the PM-4620_general-statistics branch August 11, 2026 05:24
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.

2 participants