-
Notifications
You must be signed in to change notification settings - Fork 26
AMM - 1510 | Disease summary is not reflecting in the list after saving #52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughThe Changes
Poem
Note ⚡️ AI Code Reviews for VS Code, Cursor, WindsurfCodeRabbit now has a plugin for VS Code, Cursor and Windsurf. This brings AI code reviews directly in the code editor. Each commit is reviewed immediately, finding bugs before the PR is raised. Seamless context handoff to your AI code agent ensures that you can easily incorporate review feedback. ✨ Finishing Touches
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
🧹 Nitpick comments (2)
src/main/java/com/iemr/helpline104/service/disease/DiseaseServiceImpl.java (2)
120-120: Consider removing debug logging in production code.Debug logging of predicates may clutter production logs and potentially expose internal query structure.
-logger.info("Executing disease fetch query with predicates: " + predicates); +logger.debug("Executing disease fetch query with predicates: " + predicates);Or remove entirely if not needed for ongoing debugging.
141-141: Improve response serialization format.Using
toString()on a Map may not produce proper JSON format for API responses. Consider using proper JSON serialization.-return responseMap.toString(); +return InputMapper.gson().toJson(responseMap);This ensures consistent JSON formatting across your API responses.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/main/java/com/iemr/helpline104/service/disease/DiseaseServiceImpl.java(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: Analyze (java)
🔇 Additional comments (1)
src/main/java/com/iemr/helpline104/service/disease/DiseaseServiceImpl.java (1)
110-118: LGTM! Excellent implementation of filtering and sorting logic.The addition of soft delete filtering and sorting by newest entries first directly addresses the PR objective. The Criteria API usage is correct and will ensure deleted diseases don't appear in the list.
| Disease disease = InputMapper.gson().fromJson(request, Disease.class); | ||
| Integer totalCount = diseaseRepository.getDiseaseCount(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Critical: Fix pagination calculation for filtered results.
The total count is calculated from all diseases but the actual query filters out deleted records. This mismatch will cause incorrect pagination calculations.
Apply this fix to calculate the correct total count:
-Integer totalCount = diseaseRepository.getDiseaseCount();
+Integer totalCount = diseaseRepository.getDiseaseCountExcludingDeleted();You'll also need to add this method to your repository:
@Query("SELECT COUNT(d) FROM Disease d WHERE d.deleted = false")
Integer getDiseaseCountExcludingDeleted();🤖 Prompt for AI Agents
In src/main/java/com/iemr/helpline104/service/disease/DiseaseServiceImpl.java at
lines 103-104, the totalCount is currently fetched without excluding deleted
records, causing incorrect pagination. Modify the code to call a new repository
method that counts only non-deleted diseases. Add the method
getDiseaseCountExcludingDeleted() with the query "SELECT COUNT(d) FROM Disease d
WHERE d.deleted = false" to the diseaseRepository interface, then replace the
existing totalCount assignment with a call to this new method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
@srishtigrp78 Perfect! I can see the fix has been properly implemented. The code now correctly uses diseaseRepository.getDiseaseCountExcludingDeleted() which ensures the pagination calculation matches the filtered query results. This will resolve the issue where the disease summary wasn't properly reflecting in the list after saving.
Great job addressing this critical pagination issue!
🏁 Script executed:
#!/bin/bash
# Check the current state of the getDisease method to verify the fix
ast-grep --pattern $'public String getDisease(String request) throws IEMRException {
$$$
}'
# Also check if the new repository method was added
rg "getDiseaseCountExcludingDeleted" -A 2 -B 1
Length of output: 1056
@srishtigrp78 Excellent! I can confirm the fix has been properly implemented:
✅ Repository Method Added: getDiseaseCountExcludingDeleted() with the correct query filtering out deleted records
✅ Service Updated: The getDisease method now uses the new count method
✅ Pagination Fixed: Total count now matches the filtered query results
This resolves the critical pagination issue and should fix the problem where disease summaries weren't properly reflecting in the list after saving. The pagination calculations will now be accurate for the filtered dataset.
If you found this review helpful, would you consider giving us a shout-out on X?
Thank you for using CodeRabbit!
src/main/java/com/iemr/helpline104/service/disease/DiseaseServiceImpl.java
Show resolved
Hide resolved
src/main/java/com/iemr/helpline104/service/disease/DiseaseServiceImpl.java
Show resolved
Hide resolved
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
src/main/java/com/iemr/helpline104/repository/disease/DiseaseRepository.java (1)
47-48: Fix query aliasing for consistency.The query has an inconsistent aliasing pattern. Other methods in this repository use
Disease diseaseconsistently (see lines 62, 65).Apply this diff to fix the aliasing:
-@Query("Select count(*) from Disease disease d where d.deleted = false") +@Query("Select count(*) from Disease disease where disease.deleted = false")The functionality correctly implements soft delete filtering to exclude deleted diseases from the count, which should help resolve the issue where disease summaries weren't reflecting in the list after saving.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
src/main/java/com/iemr/helpline104/repository/disease/DiseaseRepository.java(1 hunks)src/main/java/com/iemr/helpline104/service/disease/DiseaseServiceImpl.java(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- src/main/java/com/iemr/helpline104/service/disease/DiseaseServiceImpl.java
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: Analyze (java)



📋 Description
JIRA ID: 1510
Disease summary under configuration is not reflecting in the list after saving
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.
Summary by CodeRabbit
Bug Fixes
Chores