#13793 - Disabled classification popup for pathogen tests that are negative#13831
Conversation
…gative The behaviour was introduced it seems by a requirement to display the case classification popup for verified pathogen tests (positive and negative). While the behaviour might have beed desired, the actual logic in the code and popup text is not. The popup text and the logic in other blocks of the code lead us to the conclusion that only positive results trigger the popup.
📝 WalkthroughWalkthroughThis PR refactors Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Tip Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord. 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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Fix all issues with AI agents
In
`@sormas-ui/src/main/java/de/symeda/sormas/ui/samples/PathogenTestController.java`:
- Line 436: In PathogenTestController (class PathogenTestController) update the
inline comment that currently reads "// We decided this based on the intented
text in the dialog but based on the test results instead of the sample overall
result" to correct the typo "intented" to "intended" so the comment reads
"...intended text...".
- Around line 422-445: The code currently calls
checkForDiseaseVariantUpdate(resultedPathogenTest, ...) even when the selected
resultedPathogenTest is a verified negative; wrap the call to
checkForDiseaseVariantUpdate (and its nested showConfirmCaseDialog callback)
inside a guard that checks hasVerifiedPositiveTest so disease-variant update and
case-confirmation logic only runs for verified positive tests; locate the block
starting at showChangeAssociatedSampleResultDialog(...) where
resultedPathogenTest is used and add the hasVerifiedPositiveTest condition
before invoking checkForDiseaseVariantUpdate/showConfirmCaseDialog.
🧹 Nitpick comments (1)
sormas-ui/src/main/java/de/symeda/sormas/ui/samples/PathogenTestController.java (1)
426-429: Dead code:resultedPathogenTestcan never be null here.On line 424,
resultedPathogenTestis assigned viapositiveWithSameDisease.get()ornegativeWithSameDisease.get(). We're inside theif (hasVerifiedTests)block which guarantees at least oneOptionalis present, and the ternary selects the present one. The null check andIllegalStateExceptionare unreachable.Remove unreachable check
final PathogenTestDto resultedPathogenTest = hasVerifiedPositiveTest ? positiveWithSameDisease.get() : negativeWithSameDisease.get(); - - // just a sanity check - if (resultedPathogenTest == null) { - throw new IllegalStateException("No verified test found for disease " + caze.getDisease()); - }
sormas-ui/src/main/java/de/symeda/sormas/ui/samples/PathogenTestController.java
Show resolved
Hide resolved
sormas-ui/src/main/java/de/symeda/sormas/ui/samples/PathogenTestController.java
Show resolved
Hide resolved
|
SonarCloud analysis: https://sonarcloud.io/dashboard?id=SORMAS-Project&pullRequest=13831 |
Fixes #13793
Summary by CodeRabbit