Skip to content

Fix: show descending sort arrow on Document Manager "Observed" column#2486

Open
LiamStanziani wants to merge 1 commit into
developfrom
bug/document-manager-datatables-default-order-arrow-missing
Open

Fix: show descending sort arrow on Document Manager "Observed" column#2486
LiamStanziani wants to merge 1 commit into
developfrom
bug/document-manager-datatables-default-order-arrow-missing

Conversation

@LiamStanziani

@LiamStanziani LiamStanziani commented Jun 25, 2026

Copy link
Copy Markdown
Collaborator

Summary

The Document Manager table (patient Document Manager and the provider eDoc tab) is configured to default-sort by the Observed (observation date) column, newest-first. The rows do render in the correct descending order, but the column header never shows the descending (down) arrow — it displays the neutral "unsorted" up/down glyph instead. This makes it look like the table isn't sorted by Observed date at all.

The cause is a one-character typo in the DataTables initialization: the sort direction was written as 'dsc' instead of 'desc'. This change corrects it.

Found due to: Documents manager defaults to sorted by first column instead of observed date

As mentioned, this underlying issue was fixed, but this residual bug was found during the process of investigating this issue, so it was fixed.

Problem

src/main/webapp/documentManager/documentReport.jsp initializes the documents table with:

order: [[6, 'dsc']],   // column 6 = "Observed" (observation date)

'dsc' is not a valid DataTables direction (the valid values are 'asc' / 'desc'). Because of how DataTables 1.13.4 handles the value, the three pieces of "sorted" state diverge:

Aspect Result with 'dsc' Why
Row data order Descending (correct) The sort comparator only checks dir === 'asc'; anything else is treated as descending.
aria-sort attribute "descending" _fnSortAria uses dir == 'asc' ? 'ascending' : 'descending'.
Header arrow (CSS class) Neutral sorting (no arrow) The header renderer matches the direction exactly: dir == 'asc' ? sSortAsc : dir == 'desc' ? sSortDesc : <neutral>. 'dsc' matches neither branch, so the column falls back to the neutral glyph instead of sorting_desc.

So users see correctly-ordered rows but no visual indicator that the Observed column is the active (descending) sort.

The typo originates from commit d87797cb45 ("fix order grouping in document manager ordered by obs date desc"), which introduced the order option to fix an earlier "defaults to first column" bug. That commit fixed the data ordering but shipped the 'dsc' typo, leaving this residual cosmetic bug. It is present on both develop and release/2026-03-17, and affects both the patient Document Manager (function=demographic) and the provider eDoc tab (function=providers).

Solution

Change the DataTables sort direction from the invalid 'dsc' to the correct 'desc' in documentReport.jsp:

-                    order: [[6, 'desc']],
+                    order: [[6, 'desc']],

(Actual change: 'dsc''desc' on the order: line.)

This is a one-character, behavior-preserving fix: the data was already sorting descending, and now the header correctly renders the sorting_desc (down-arrow) class so the Observed column visibly shows it is the active descending sort.

UI Before:

image (3)

UI After:

image (4)

Verification

Verified live in the running app (logged in, demographic 1 + provider eDoc tab):

  • Before ('dsc'): Observed header class = sorting (neutral, no arrow); rows ordered descending.
  • After ('desc'): Observed header class = sorting sorting_desc (down arrow shown); rows ordered descending — identical data order, only the indicator changes.

Confirmed on both tables of the provider eDoc view (private tblDocs0 and published tblDocs1).

Summary by Sourcery

Bug Fixes:

  • Fix the DataTables order configuration typo so the Observed column shows the correct descending sort indicator without changing row order.

Summary by cubic

Fixes the missing descending arrow on the Observed column in the Document Manager and provider eDoc tables by correcting the DataTables sort direction from 'dsc' to 'desc'. Rows were already sorted newest-first; now the header correctly shows the active descending arrow.

Written for commit 7c4cb06. Summary will update on new commits.

Review in cubic

Summary by CodeRabbit

  • Bug Fixes
    • Fixed the initial sorting of the document report table so it now opens in descending order correctly.

@LiamStanziani LiamStanziani self-assigned this Jun 25, 2026
@coderabbitai

coderabbitai Bot commented Jun 25, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The document report table initialization now uses the valid descending sort value for column 6.

Changes

Document report sorting

Layer / File(s) Summary
Initial sort direction
src/main/webapp/documentManager/documentReport.jsp
The DataTables order setting now uses desc for column 6 instead of dsc.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Possibly related PRs

  • openo-beta/Open-O#2415: Also updates a DataTables initialization to correct the initial sort direction in a JSP.

Suggested reviewers

  • D3V41

Poem

I’m a rabbit with a tidy nose,
I hopped where the document table goes.
One little desc and off it spun,
Sorting straight like morning sun.
Thump-thump, the report looks neat!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the change: it fixes the Document Manager Observed column to display the descending sort indicator.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch bug/document-manager-datatables-default-order-arrow-missing

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.

@github-actions

Copy link
Copy Markdown

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Snapshot Warnings

⚠️: No snapshots were found for the head SHA 7c4cb06.
Ensure 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 Files

None

@sourcery-ai

sourcery-ai Bot commented Jun 25, 2026

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Corrects the DataTables default sort direction for the Document Manager / eDoc "Observed" column so the header shows the descending sort arrow while preserving the existing newest-first data ordering.

File-Level Changes

Change Details Files
Fix DataTables default sort configuration for the Observed column to use a valid descending direction so the UI shows the correct active sort state.
  • Update the DataTables order option to use 'desc' for column index 6 (Observed date) instead of the invalid 'dsc' value.
  • Rely on DataTables’ existing behavior so that row ordering remains newest-first while the header now receives the sorting_desc class and shows the descending arrow.
  • Apply the change in the shared JSP so it affects both the patient Document Manager and provider eDoc document tables.
src/main/webapp/documentManager/documentReport.jsp

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request corrects the sorting order option in the DataTables configuration within documentReport.jsp from 'dsc' to 'desc'. There are no review comments, so I have no feedback to provide.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

@LiamStanziani

Copy link
Copy Markdown
Collaborator Author

@SourceryAI review

@LiamStanziani

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jun 25, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@LiamStanziani LiamStanziani marked this pull request as ready for review June 25, 2026 20:24
@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 1 file

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Re-trigger cubic

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.

2 participants