Skip to content

fix account page date order - #2109

Merged
yagebu merged 1 commit into
beancount:mainfrom
upsuper-forks:get-account-report-fix
Oct 12, 2025
Merged

fix account page date order#2109
yagebu merged 1 commit into
beancount:mainfrom
upsuper-forks:get-account-report-fix

Conversation

@upsuper

@upsuper upsuper commented Sep 24, 2025

Copy link
Copy Markdown
Contributor

In #2058, the journal returned from /account_report was incorrectly reversed, and consequently the sort value for date was wrong in the template.

This was a remnant from early iterations when the index was always derived from the order passed to the template. Later iteration changes it to explicitly pass the index when doing pagination, so non-paginated path was no longer affected, but the json path was not reverted accordingly.

This PR fixes the issue by making the two paths work more consistently through adding explicit index to account journal as well. This makes the journal template still always render in reverse chronological order but with the right date index passed in.

The diff of the snapshot is:

--- a	2025-09-24 10:41:50.855628847 +1000
+++ b	2025-09-24 10:41:55.255510019 +1000
@@ -12,7 +12,7 @@
  </li>
  <li class="transaction cleared">
  <p>
- <span class="datecell" data-sort-value="1"><a href="#context-ENTRY_HASH">2022-01-01</a></span>
+ <span class="datecell" data-sort-value="4"><a href="#context-ENTRY_HASH">2022-01-01</a></span>
  <span class="flag">*</span>
  <span class="description droptarget" data-entry="ENTRY_HASH" data-entry-date="2022-01-01" data-account-name="Assets:Cash">
  <strong class="payee"></strong>Buy
@@ -56,7 +56,7 @@
  </li>
  <li class="transaction cleared">
  <p>
- <span class="datecell" data-sort-value="2"><a href="#context-ENTRY_HASH">2022-01-01</a></span>
+ <span class="datecell" data-sort-value="3"><a href="#context-ENTRY_HASH">2022-01-01</a></span>
  <span class="flag">*</span>
  <span class="description droptarget" data-entry="ENTRY_HASH" data-entry-date="2022-01-01" data-account-name="Assets:Cash">
  <strong class="payee"></strong>Transfer
@@ -100,7 +100,7 @@
  </li>
  <li class="open ">
  <p>
- <span class="datecell" data-sort-value="3"><a href="#context-ENTRY_HASH">2022-01-01</a></span>
+ <span class="datecell" data-sort-value="1"><a href="#context-ENTRY_HASH">2022-01-01</a></span>
  <span class="flag">Open</span>
  <span class="description">
  <a href="/off-by-one/account/Assets:Cash/?conversion=at_value&amp;interval=day">Assets:Cash</a>
@@ -114,7 +114,7 @@
  </li>
  <li class="open ">
  <p>
- <span class="datecell" data-sort-value="4"><a href="#context-ENTRY_HASH">2022-01-01</a></span>
+ <span class="datecell" data-sort-value="0"><a href="#context-ENTRY_HASH">2022-01-01</a></span>
  <span class="flag">Open</span>
  <span class="description">
  <a href="/off-by-one/account/Assets:Commodity/?conversion=at_value&amp;interval=day">Assets:Commodity</a>

as you can see the sort value is now correct.

@upsuper

upsuper commented Oct 2, 2025

Copy link
Copy Markdown
Contributor Author

Hey @yagebu, it's probably a serious regression, so I tend to think there is some urgency to fix it. Could you please take a quick look at this PR?

@kba977

kba977 commented Oct 3, 2025

Copy link
Copy Markdown

I’m also experiencing the same issue by this regression too, so I’d appreciate it if this could be fixed soon.

@yagebu

yagebu commented Oct 12, 2025

Copy link
Copy Markdown
Member

Fixes #2113

@yagebu
yagebu merged commit 1a22736 into beancount:main Oct 12, 2025
15 checks passed
@yagebu

yagebu commented Oct 12, 2025

Copy link
Copy Markdown
Member

Thanks :)

@upsuper
upsuper deleted the get-account-report-fix branch October 12, 2025 19:35
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