fix(parser): pass user_id to stats DBWriter in main#50
Merged
Conversation
The stats background thread was instantiated without user_id, so it defaulted to 'demo_openmrg'. refresh_stats() uses self.user_id both as the argument to update_cml_stats() and as the WHERE filter on cml_metadata, meaning stats were never computed for any other user (CTU, Orange Cameroun) — causing map line colouring to show no colour for their CMLs. Fix: pass user_id=Config.USER_ID so each parser instance refreshes stats for its own user.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #50 +/- ##
==========================================
+ Coverage 82.63% 85.08% +2.45%
==========================================
Files 28 24 -4
Lines 2920 2575 -345
==========================================
- Hits 2413 2191 -222
+ Misses 507 384 -123
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
The stats background thread was instantiated as DBWriter(Config.DATABASE_URL), omitting user_id. It silently defaulted to 'demo_openmrg'. refresh_stats() uses self.user_id both as the argument to update_cml_stats() and as the WHERE filter on cml_metadata, so stats were never computed for any user other than demo_openmrg — causing map line colouring to show no colour for all other users' CMLs.
Fix: DBWriter(Config.DATABASE_URL, user_id=Config.USER_ID).