4
11
Fork
You've already forked tomato
1

Show monthly/task totals on tracker show page #183

Merged
edwardloveall merged 1 commit from el-tracker-totals into main 2026年07月09日 15:11:38 +02:00

TrackerTotals is similar to RecentTaskLogTotals. It sums and groups task log
totals by month and task, instead of RecentTaskLogTotals which does it by
month and food taxonomy.

For styling, I reused the sites table because it looks similar to the list-table
styles, but can work better with variable columns. Because we're using tasks as
the columns, these tables can get large. So I also wrapped the table in a
scrolling container. There's a nice side benefit that we get that we can make a
minimum column width (only if table-layout: auto;) so that they don't get
squished too much.

Screen Shot 2026年07月08日 at 16.40.14-fullpage

`TrackerTotals` is similar to `RecentTaskLogTotals`. It sums and groups task log totals by month and task, instead of `RecentTaskLogTotals` which does it by month and food taxonomy. For styling, I reused the sites table because it looks similar to the list-table styles, but can work better with variable columns. Because we're using tasks as the columns, these tables can get _large_. So I also wrapped the table in a scrolling container. There's a nice side benefit that we get that we can make a minimum column width (only if `table-layout: auto;`) so that they don't get squished too much. ![Screen Shot 2026年07月08日 at 16.40.14-fullpage](/attachments/ce61bcc1-9e89-4410-9b75-e287a13c45ff)
Show monthly/task totals on tracker show page
Some checks failed
ci/woodpecker/pr/ci Pipeline failed
4f158e9a53
`TrackerTotals` is similar to `RecentTaskLogTotals`. It sums and groups task log
totals by month and task, instead of `RecentTaskLogTotals` which does it by
month and food taxonomy.
For styling, I reused the sites table because it looks similar to the list-table
styles, but can work better with variable columns. Because we're using tasks as
the columns, these tables can get _large_. So I also wrapped the table in a
scrolling container. There's a nice side benefit that we get that we can make a
minimum column width (only if `table-layout: auto;`) so that they don't get
squished too much.
thetizzo left a comment
Copy link

The idea behind using DB views instead of tables is because these are somewhat transient datasets that would need to have some mechanism to keep them up to date in a normal table and using views removes the need for building an updating system?

The idea behind using DB views instead of tables is because these are somewhat transient datasets that would need to have some mechanism to keep them up to date in a normal table and using views removes the need for building an updating system?
Author
Owner
Copy link

@thetizzo wrote in #183 (comment):

The idea behind using DB views instead of tables is because these are somewhat transient datasets that would need to have some mechanism to keep them up to date in a normal table and using views removes the need for building an updating system?

Yes, and also the views are:

  • a nice abstraction
  • sooooo much faster to calculate than anything I could put together with ActiveRecord

The amount of complex grouping and summing logic would be untenable for any AR query. I did a similar thing in #178 where the old ruby version was fine speed-wise, until I switched a new data layout which AR + Ruby could not calculate in any reasonable time.

@thetizzo wrote in https://codeberg.org/rootable/tomato/pulls/183#issuecomment-18827540: > The idea behind using DB views instead of tables is because these are somewhat transient datasets that would need to have some mechanism to keep them up to date in a normal table and using views removes the need for building an updating system? Yes, and also the views are: - a nice abstraction - sooooo much faster to calculate than anything I could put together with ActiveRecord The amount of complex grouping and summing logic would be untenable for any AR query. I did a similar thing in https://codeberg.org/rootable/tomato/pulls/178 where the old ruby version was fine speed-wise, until I switched a new data layout which AR + Ruby could not calculate in any reasonable time.
edwardloveall force-pushed el-tracker-totals from 4f158e9a53
Some checks failed
ci/woodpecker/pr/ci Pipeline failed
to c8fdad00c4
All checks were successful
ci/woodpecker/pr/ci Pipeline was successful
2026年07月08日 22:56:27 +02:00
Compare
edwardloveall changed target branch from el-tracker-create to main 2026年07月09日 15:11:02 +02:00
edwardloveall deleted branch el-tracker-totals 2026年07月09日 15:11:39 +02:00
Sign in to join this conversation.
No reviewers
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
rootable/tomato!183
Reference in a new issue
rootable/tomato
No description provided.
Delete branch "el-tracker-totals"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?