Skip to content

Optmize/incentive apis response time - #392

Open
SauravBizbRolly wants to merge 26 commits into
release-3.11.0from
optmize/incentive_apis_response_time
Open

SauravBizbRolly wants to merge 26 commits into
release-3.11.0from
optmize/incentive_apis_response_time

Conversation

@SauravBizbRolly

Copy link
Copy Markdown
Collaborator

📋 Description

JIRA ID:

Please provide a summary of the change and the motivation behind it. Include relevant context and details.


✅ Type of Change

  • 🐞 Bug fix (non-breaking change which resolves an issue)
  • ✨ New feature (non-breaking change which adds functionality)
  • 🔥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • 🛠 Refactor (change that is neither a fix nor a new feature)
  • ⚙️ Config change (configuration file or build script updates)
  • 📚 Documentation (updates to docs or readme)
  • 🧪 Tests (adding new or updating existing tests)
  • 🎨 UI/UX (changes that affect the user interface)
  • 🚀 Performance (improves performance)
  • 🧹 Chore (miscellaneous changes that don't modify src or test files)

ℹ️ Additional Information

Please describe how the changes were tested, and include any relevant screenshots, logs, or other information that provides additional context.

vaibhav45sktech and others added 25 commits September 7, 2026 16:12
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
@coderabbitai

coderabbitai Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 6cae7b3c-74dd-479d-8e3a-894e484953c7
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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