fix: restore drug profile legend and filter tab functionality broken by DataTables upgrade#2404
fix: restore drug profile legend and filter tab functionality broken by DataTables upgrade#2404
Conversation
Reviewer's GuideRestores the drug profile legend UI (tabs and change-view link) in SearchDrug3.jsp and re-enables server-side filtering in ListDrugs.jsp so that the profile tabs once again return correctly filtered drug lists. Sequence diagram for restored drug profile tab filteringsequenceDiagram
actor Clinician
participant Browser
participant SearchDrug3_jsp
participant ListDrugs_jsp
Clinician->>Browser: Clicks Active_tab
Browser->>SearchDrug3_jsp: onclick callReplacementWebService(ListDrugs.jsp?status=active, drugProfile)
activate SearchDrug3_jsp
SearchDrug3_jsp->>ListDrugs_jsp: HTTP GET ListDrugs.jsp?status=active
activate ListDrugs_jsp
ListDrugs_jsp->>ListDrugs_jsp: Apply status and longTermOnly and drugLocation filters
ListDrugs_jsp-->>SearchDrug3_jsp: Filtered HTML fragment for drugProfile
deactivate ListDrugs_jsp
SearchDrug3_jsp-->>Browser: Updated drugProfile HTML
deactivate SearchDrug3_jsp
Browser->>Browser: Replace drugProfile div contents
Clinician->>Browser: Clicks LongTermAcuteInactiveExternal_tab
Browser->>SearchDrug3_jsp: Multiple calls to callReplacementWebService and callAdditionWebService
activate SearchDrug3_jsp
SearchDrug3_jsp->>ListDrugs_jsp: GET ListDrugs.jsp?longTermOnly=true&heading=Long_Term_Meds
SearchDrug3_jsp->>ListDrugs_jsp: GET ListDrugs.jsp?longTermOnly=acute&heading=Acute&status=active
SearchDrug3_jsp->>ListDrugs_jsp: GET ListDrugs.jsp?longTermOnly=acute&heading=Inactive&status=inactive
SearchDrug3_jsp->>ListDrugs_jsp: GET ListDrugs.jsp?heading=External&drugLocation=external
ListDrugs_jsp-->>SearchDrug3_jsp: Filtered segments for each request
deactivate SearchDrug3_jsp
Browser->>Browser: Render combined filtered profile view
File-Level Changes
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Review Summary by QodoRestore drug profile legend and filter tabs functionality
WalkthroughsDescription• Uncomments server-side drug filtering logic in ListDrugs.jsp - Restores Active, Inactive, Long Term/Acute, External filter functionality • Restores drug profile legend table in SearchDrug3.jsp - Re-adds filter tabs and "Change View" link that were removed Diagramflowchart LR
A["DataTables Upgrade<br/>Broke Filtering"] --> B["Commented Code<br/>in ListDrugs.jsp"]
C["Missing Legend<br/>in SearchDrug3.jsp"] --> D["No Filter Tabs<br/>or Change View Link"]
B --> E["Uncomment<br/>Filter Logic"]
D --> F["Restore Legend<br/>Table HTML"]
E --> G["Active/Inactive<br/>Filters Work"]
F --> H["Filter Tabs &<br/>Change View Restored"]
File Changes1. src/main/webapp/oscarRx/ListDrugs.jsp
|
Code Review by Qodo
|
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Snapshot WarningsEnsure that dependencies are being submitted on PR branches and consider enabling retry-on-snapshot-warnings. See the documentation for more information and troubleshooting advice. Scanned FilesNone |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
✅ Files skipped from review due to trivial changes (2)
📝 WalkthroughWalkthroughRe-enables request-driven row filtering in Changes
Sequence Diagram(s)sequenceDiagram
actor User
participant Legend as SearchDrug3.jsp (Legend UI)
participant AJAX as AJAX Request
participant ListDrugs as ListDrugs.jsp (Filter & Render)
participant Browser as Browser DOM
User->>Legend: Click filter link
Legend->>AJAX: callReplacementWebService / callAdditionWebService (filter params)
AJAX->>ListDrugs: GET ListDrugs.jsp with params (status, longTermOnly, drugLocation)
ListDrugs->>ListDrugs: Iterate prescriptDrugs, apply request filters, skip non-matching rows
ListDrugs-->>AJAX: Return filtered HTML
AJAX-->>Browser: Replace `drugProfile` content and call CngClass
Browser-->>User: Rendered filtered drug list
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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.
Code Review
This pull request restores filtering logic in ListDrugs.jsp and introduces a new legend UI in SearchDrug3.jsp for filtering drug profiles. The feedback suggests optimizing the restored logic by reducing redundant request parameter calls and using more idiomatic string comparisons to improve code quality and maintainability.
There was a problem hiding this comment.
Hey - I've found 1 issue, and left some high level feedback:
- In ListDrugs.jsp, the repeated
request.getParameter(...)lookups and string equality checks forstatus,longTermOnly, anddrugLocationwould be easier to maintain if you cached the parameters into local variables and normalized them once before the loop. - The legend markup in SearchDrug3.jsp repeats
<fmt:setBundle basename="oscarResources"/>multiple times inside anchors; consider setting the bundle once at a higher scope to reduce noise and potential mistakes. - The long
onclickhandlers in SearchDrug3.jsp that concatenate multiplecallReplacementWebService/callAdditionWebServicecalls are hard to read and error-prone; consider extracting them into named JavaScript functions to make the behavior clearer and easier to modify.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- In ListDrugs.jsp, the repeated `request.getParameter(...)` lookups and string equality checks for `status`, `longTermOnly`, and `drugLocation` would be easier to maintain if you cached the parameters into local variables and normalized them once before the loop.
- The legend markup in SearchDrug3.jsp repeats `<fmt:setBundle basename="oscarResources"/>` multiple times inside anchors; consider setting the bundle once at a higher scope to reduce noise and potential mistakes.
- The long `onclick` handlers in SearchDrug3.jsp that concatenate multiple `callReplacementWebService`/`callAdditionWebService` calls are hard to read and error-prone; consider extracting them into named JavaScript functions to make the behavior clearer and easier to modify.
## Individual Comments
### Comment 1
<location path="src/main/webapp/oscarRx/SearchDrug3.jsp" line_range="1223-1224" />
<code_context>
+ <table class="legend">
+ <tr>
+ <td class="legend-change-view">
+ <a href="#"
+ title="<fmt:setBundle basename="oscarResources"/><fmt:message key="provider.rxChangeProfileViewMessage"/>"
+ onclick="popupPage(230,860,'../setProviderStaleDate.do?method=viewRxProfileView');"
+ class="link-red-no-decoration">
</code_context>
<issue_to_address>
**issue (bug_risk):** The nested double quotes in the `title` attribute will break JSP/HTML parsing; adjust quoting for the JSTL tags.
Because the `title` attribute is in double quotes, the inner `<fmt:setBundle basename="oscarResources"/>` also using double quotes will prematurely close the `title` value and break JSP/HTML parsing. Use a consistent quoting strategy, e.g. single quotes for the JSTL attributes (`basename='oscarResources'`) or single quotes around the HTML attribute and keep double quotes inside. Apply the same fix to any other attributes embedding JSTL tags.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
There was a problem hiding this comment.
1 issue found across 2 files
Confidence score: 4/5
- There’s a minor but concrete UI risk: the nested double quotes in the
titleattribute could break HTML attribute parsing insrc/main/webapp/oscarRx/SearchDrug3.jsp. - Severity is moderate (6/10) and localized, so overall this looks safe to merge with minimal risk if the markup is corrected.
- Pay close attention to
src/main/webapp/oscarRx/SearchDrug3.jsp- fix thetitleattribute quoting to avoid malformed HTML.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="src/main/webapp/oscarRx/SearchDrug3.jsp">
<violation number="1" location="src/main/webapp/oscarRx/SearchDrug3.jsp:1224">
P2: Nested double quotes in the `title` attribute will break HTML attribute parsing. `basename="oscarResources"` uses double quotes inside a double-quoted `title`, which can cause the attribute value to be prematurely terminated. Other title attributes in this same block correctly use single quotes for JSTL tag attributes (e.g., `basename='oscarResources'`). Use single quotes consistently for JSTL attributes inside double-quoted HTML attributes.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
… DataTables upgrade
0211d37 to
e192e60
Compare
Summary
SearchDrug3.jspthat was removed in edac1715d550de8062d066badc82eab62d833908ListDrugs.jspthat was commented out in the same commit, causing the Active, Inactive, Long Term/Acute, and External filter tabs to return unfiltered results regardless of which tab was clickedSummary by Sourcery
Restore drug profile legend and filtering functionality in the prescription UI.
Bug Fixes:
Summary by cubic
Restores the drug profile legend (Change View + filter tabs) and fixes server-side filtering and section headings broken by the DataTables upgrade. Users can switch views and see correct Active, Inactive, Long Term, Acute, and External lists with proper headings.
SearchDrug3.jspwith tabs wired toListDrugs.jspAJAX calls, including the combined Long Term/Acute/Inactive/External view.ListDrugs.jspforstatus,longTermOnly, anddrugLocation, and restored section headings (Long Term Meds, Acute, Inactive, External).Written for commit e192e60. Summary will update on new commits.
Summary by CodeRabbit
Bug Fixes
New Features