PM-5880 - exclude specific users from general statistics - #152
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces the ability to exclude specific user IDs from general statistics reports, such as country member details and top winners by country. This exclusion is configurable via a new environment variable and is consistently applied across the backend logic and SQL queries. The changes also include robust parsing of configuration values and comprehensive test coverage for the new feature.
Configuration and Exclusion Logic:
REPORTS_EXCLUDED_USER_IDSenvironment variable toREADME.mdto allow configuration of user IDs to be excluded from general statistics reports.GeneralStatisticsService(src/statistics/general-statistics.service.ts) to parse the new exclusion config, handle both JSON arrays and comma-separated lists, and ensure all IDs are treated as strings. [1] [2]SQL Query Updates:
sql/reports/statistics/general/country-member-details.sqlandsql/reports/statistics/general/top-winners-by-country.sqlto exclude rows where the user ID matches any in the exclusion list. [1] [2]Backend Integration:
GeneralStatisticsServiceto pass the excluded user IDs as a parameter to SQL, ensuring exclusions are enforced at the query level. [1] [2]Testing Improvements:
src/statistics/general-statistics.service.spec.tsto verify that excluded user IDs are correctly handled, including cases with defaults and unset configs. Also updated SQL snapshot tests to check for the new exclusion logic. [1] [2] [3] [4] [5] [6]