Repository navigation
Optmize/incentive apis response time - #392
Open
SauravBizbRolly wants to merge 26 commits into
Open
SauravBizbRolly wants to merge 26 commits into
SauravBizbRolly wants to merge 26 commits into
Conversation
GET /badges/{config,freezes,earned} and POST /badges/earned; the ASHA is
taken from the JWT, re-uploads are idempotent, defaults seeded on boot.
(user_id, badge_id, level) is not unique for every badge. Quarterly badges are re-earned each quarter at the same level, and per-case badges once per beneficiary, so two genuine awards collided on the old constraint: the second was silently skipped as a duplicate on upload and could not be told apart on restore. badge_earned gains award_key and the unique key becomes (user_id, badge_id, level, award_key). The key is a quarter key such as "2026-Q3", or an opaque digest for per-case awards, and empty for streak and cumulative badges, which are earned once per level. It is never a beneficiary identifier. The device hashes those before they are sent, so this column can separate two awards without the server learning who either was about (Badge LLD §4). A missing key is stored as empty rather than rejected. That is what a streak or cumulative badge sends, and also what a client predating the field sends for everything, so such a client keeps behaving exactly as it did before. Verified: 8 badge tests pass, including two new ones covering two awards of the same level under different keys, and a null key from an older client. The rest of the suite does not compile on this branch's base and was excluded from the run, unchanged.
…drift The build_and_check_coverage job compiles the whole test module, which already failed to compile on main independent of this PR: several test classes called service/repo methods with the wrong argument count, stubbed mocks with a return type that no longer matches the real repo method (List<T> vs a single T), or referenced a repo method that had been renamed/replaced (DeathReportsServiceImplTest called methods that don't exist on CdrRepo/MdsrRepo; the real impl looks up the user via UserServiceRoleRepo.getUserNamedByUserId and queries findByCreatedBy). Fixed by aligning each call to the current production signature: IncentiveRecordRepo.findRecordByActivityIdCreatedDateBenId needs a 4th ashaId/userId argument; MaternalHealthService.saveANCVisit now takes a userId; TBScreeningRepo.getByUserId takes one Integer, not three args; BeneficiaryRepo/HouseHoldRepo lookups return List<T> and were being stubbed with a bare object. ChildCareServiceImplTest's HBNC/HBYC block tested a data shape (per-part DTOs, findHBYCByBenIdAndCreatedDate, findHbncVisit*ByBenIdAndVisitNo) that no longer exists anywhere in ChildCareServiceImpl at all -- it was left out with an explanatory comment rather than guessed at, since production code was not touched to make this compile. No src/main sources were changed.
Resolves conflicts in eight pre-existing test files. This branch had touched them only to unblock test-compile against drifted signatures; main has since fixed the same drift in its own test rewrites, so main's versions win wholesale. The badges endpoints, entities and their tests are untouched — they never conflicted. mvn test-compile passes on the merged tree.
feat(badges): config, freezes and earned-log endpoints for the SAKHI badges module
Release 3.11.0
Fix/image issue village level
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
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.
📋 Description
JIRA ID:
Please provide a summary of the change and the motivation behind it. Include relevant context and details.
✅ Type of Change
ℹ️ Additional Information
Please describe how the changes were tested, and include any relevant screenshots, logs, or other information that provides additional context.