Conversation
Prior to this, the timesheet export ("Export all" and "Export FR")
could take several minutes and time out in production when exporting a
long period or many users.
This is caused by an N+1 query pattern: for every exported record, the
backend reloaded the user's teams from the organization service (3
queries per record for the TS code generation), the teams of the
record's activity, the sales orders of every converted client and the
user's social identity, on top of the per-relation loading of each
record's JPA graph - roughly 5 to 10 queries per exported row.
This commit fixes the problem by loading each record's object graph in
a single SQL query (fetch joins in ActivityRecordDAO), converting
record lists with per-call caches (teams per user, teams per activity,
client DTOs and identity full names are now loaded once per distinct
value instead of once per record), and skipping the redundant count
query when the whole list is fetched without pagination. A timing log
(operation=get-records-list ... duration_ms) is also added on the
listing/export endpoint to monitor it in production.
Measured on the same 2436-record dataset, server-side export time goes
from ~2-3.2s to ~60-110ms locally; the gap is far larger in production
where every extra query pays real database latency.
The "Duplicate" action of the timesheet used to create a single copy of an entry on one chosen date. The date picker of the duplication drawer now accepts a date range: when two dates are selected, one copy of the entry is created on every day of the range (bounds included) in a single REST call, skipping Saturdays and Sundays unless the new "Include weekends" checkbox is ticked. Selecting a single date keeps the previous behavior. The new endpoint POST activityrecord/range applies the same security rules as the single-record creation (a non-manager can only create records for himself), rejects invalid or reversed ranges and ranges over 366 days with HTTP 400, and returns the number of created records shown in the success message.
mkrout
enabled auto-merge (rebase)
August 24, 2026 19:07
azayati
approved these changes
Aug 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.