Skip to content

Show Time Worked on Each Ticket and What Was Sent to Redmine - #920

Merged
SarkarShubhdeep merged 27 commits into
mainfrom
feat/916-ticket-time-log
Dec 4, 2026
Merged

SarkarShubhdeep merged 27 commits into
mainfrom
feat/916-ticket-time-log

Conversation

@SarkarShubhdeep

@SarkarShubhdeep SarkarShubhdeep commented Dec 2, 2026 •

Copy link
Copy Markdown
Collaborator

Closes #916

What changes

Time you've worked on a ticket, and how much of it reached Redmine, now shows on screens you already use. There's no new screen.

Where What you see
Tickets list, every row (All tickets and My Board) A chip on the row's top line with your total time on the ticket, e.g. "2h 10m". It shows only when you have a minute or more on the ticket.
Ticket page header A badge with the same total, e.g. "2h 10m logged". It updates when your timer starts or stops.
Ticket page timer "Resume · 2h 10m" instead of "Start timer" when you have time on the ticket, or "Add & Resume · …" when it isn't on My Board. While the timer runs, the button is a small pause button with a green time pill beside it, the same height as the other buttons.
Activity card on the ticket page Each finished session says how much of its day went to Redmine, for example "Sent 0.5 h to Redmine", "Sent 0.5 h to Redmine, 20m not sent yet", "10m not sent to Redmine yet" or "Marked "Never send"". It links to that day's time in Redmine: "View in Redmine ↗".
Timesheet Under each shift, one row per ticket (not per session), with its time and the same Redmine line. A source filter on the right of the Sessions header narrows the tickets and their time to the sources you pick.
Clock-out wrap-up Each ticket in the wrap-up message posted to Huddle shows the time you spent on it that session, e.g. 1h 20m.
CleanShot 2026-12-04 at 12 11 27 PM@2x CleanShot 2026-12-04 at 11 38 39 AM@2x CleanShot 2026-12-04 at 11 27 22 AM@2x CleanShot 2026-12-04 at 11 35 26 AM@2x

What the total counts

  • Your own time only, never other people's.
  • Time from TimeHuddle's timers. Finished runs count; a running timer is added when it stops.
  • Time that goes to Redmine counts as Redmine will hold it. This covers a Redmine issue's time, and a Huddle ticket's time while it was linked to an issue. For each day, time marked Never send is taken out, and the rest is rounded up to the step the organization set for that Redmine server. That is the same formula a send uses, now shared (owedMinutes), so the chip matches Redmine before and after you send. Time not sent yet counts, since it can still be sent. Time logged while a ticket wasn't linked stays exact.
  • Your own time logged in Redmine that this TimeHuddle didn't send. That covers time entered in Redmine itself, or sent from another TimeHuddle, on the issue or on the issue a ticket is linked to. Entries this TimeHuddle sent are left out, since they're already counted from its timers.

Timesheet source filter

  • A ghost Funnel button on the far right of the Sessions header. It appears only when there's more than one source.
  • The list has All and then each source, named by the identifier your organization registered (TH, PM0), not by the server's name.
  • You can pick several sources. Picking every one turns All back on, and the button then reads "All sources".
  • Filtering narrows each shift's tickets and their durations. Shifts with no ticket time on the picked sources are hidden. The summary cards above the list are unchanged.

How it works

  • Receipts (redmine-receipts.js, redmine-receipts-core.js). These work out, for each closed session, how much of its Redmine issue-day was sent. They use the same redmineTicketDaysFor, pushLedgerFor and unsentTotals as the Send dialog, so the two always agree. A receipt is { issueId, date, url, entries: [{ id, hours }], discarded, unsentSeconds }. url is Redmine's spent-time list filtered to the issue, the day and the caller (/time_entries?set_filter=1&issue_id=…&user_id=me&spent_on=…). Receipts come back only to someone with a Redmine account, for their own time, and on the timesheet only for their own sheet.
  • timers.getTicketTotals({ tickets: [{ source, ticketId }] }) (new). Returns totals keyed source:ticketId, for up to 500 tickets per call; the client splits longer lists. A source without timers (GitHub, for now) is skipped, not refused. A ticket with nothing left to show has no entry.
  • timers.getTicketTotal. Now counts the same way as the list, so a row's chip and its page header agree.
  • Time that goes to Redmine.
    • roundedIssueSeconds covers Redmine issues. linkedSendAdjustment covers linked Huddle tickets: it's added to their exact time, and is negative where time was marked Never send.
    • Both use the Send's own roundingStepsFor, pushLedgerFor and the shared owedDaySeconds / owedMinutes in redmine-time-entries.js.
  • Time in Redmine only (ownRedmineOnlyByIssue).
    • Reads the caller's newest 500 Redmine time entries (user_id=me, up to 5 pages), cached for 5 minutes.
    • The cache is cleared when the user sends, connects or disconnects.
    • Entries in the ledger, i.e. sent by this TimeHuddle, are subtracted.
    • One read covers a whole list, not one call per row. If Redmine can't be reached, totals fall back to TimeHuddle time.
  • Screens stay current. A send or Never send, from the Clock page's dialog or the prompt after a timer stops, dispatches tickets:refetch (refreshTicketTimes), which the rows, the ticket page and its Activity already reload on.
  • Under a minute. formatLoggedTime hides the total below 60 seconds on the row chip, the header badge and the Resume label, rather than showing "0m".
  • Wrap-up times (wrapUpTimes.ts). On clock-out, each linked ticket in the wrap-up post gets its session time appended (sessionSecondsByTicket, withTicketTimes), counting a running stint up to the clock-out.
  • timers.getTicketSessions and clock.timesheet. Their ticket sessions now include redmine. The timesheet's ticket sessions also include date and redmineIssueId.
  • Timesheet filter (timesheetSources.ts, TimesheetSourceFilter.tsx). Built from @mieweb/ui Dropdown, DropdownItem and a ghost Button. Each choice is a menuitemcheckbox.
  • Removed: the unused ticketApi.getTotal, and the "Stop timer" label the ticket page no longer shows.

Known limits

  • Older Redmine-only time. Only the newest 500 of your Redmine entries count, so very old time logged only in Redmine can be missing from a total.
  • Up to 5 minutes' delay. Time logged in Redmine takes up to 5 minutes to show.
  • Sent entries aren't read back. If an entry TimeHuddle sent is later edited in Redmine, TimeHuddle still shows what it sent.
  • Timesheet, Activity and the wrap-up stay exact. They list individual runs, sessions and shifts, while rounding applies to a whole issue-day.
  • Two tickets on one Redmine issue. When two Huddle tickets are linked to the same issue, each is rounded on its own, and a day marked Never send is split between them in the order they're read. Their chips can then add up to slightly more than Redmine holds.
  • GitHub issues have no time yet. They will once GitHub timers land (Connect a Member's GitHub Account and Show Their GitHub Issues on Tickets #874).

Release note

Added to release-notes/1.3.0.md under "See the time you've logged on each ticket", with a line for #920 in the pull request list.

Tests

  • Unit:
    • redmine-receipts-core.test.ts, redmineReceipt.test.ts, shiftTicketRows.test.ts, timesheetSources.test.ts, TimesheetSourceFilter.test.tsx and wrapUpTimes.test.ts.
    • New cases in activityEntries.test.ts, TimesheetRow.test.tsx, redmine-time-entries.test.ts (owedDaySeconds) and timeUtils.test.ts (formatLoggedTime).
  • Integration:
    • timers.test.ts covers getTicketTotals: scoped to the caller, a Redmine issue including its linked ticket's time, a GitHub ticket skipped, and a missing list refused.
    • ticket-totals-redmine.test.ts (new) runs against a stand-in Redmine. It covers days rounded as a send rounds them, time logged only in Redmine added without counting a sent entry twice, time marked Never send left out, and a row and its ticket page agreeing.
  • e2e: tests/e2e/timers/ticket-time-log.spec.ts covers the header badge and Resume label, the Activity receipt and its View in Redmine link, and the timesheet ticket rows. The full suite was run locally, and every failure from that run passes on its own.
  • Checks: lint, typecheck and format are clean; 1,223 frontend and 742 backend unit tests pass. The Meteor backend's lint and typecheck report only what's already on main: none of their errors are in files this PR changes.

🤖 Generated with Claude Code

…ne (#916)

- Ticket page header shows your total time; its timer reads "Resume · 2h 10m"
- Tickets list timer tooltip and label resume the logged total (timers.getTicketTotals)
- Activity sessions and timesheet ticket rows say what of each day was sent to
  Redmine, with links to the entries (redmine-receipts.js)
- Timesheet lists one row per ticket under each shift

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Dec 2, 2026 •

Copy link
Copy Markdown

🗑️ Preview Environment Cleaned Up

The preview container for this PR has been deleted.

SarkarShubhdeep and others added 7 commits December 3, 2026 10:43
…916)

The receipt line ended with Redmine time entry ids (#668), which read like
ticket numbers and opened an edit form that needs edit permission. It now
ends with one "View in Redmine" link to the issue's spent time, filtered to
that day and the viewer.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A Source dropdown in the Sessions header picks All or any of the viewer's
sources, each named by its registered identifier (TH, RM0). Picked sources
keep only the shifts and tickets with time on them, open their ticket lists,
and show their total beside the session count. A Huddle ticket linked to a
Redmine issue counts under Redmine, where its time goes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…source filter (#916)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…cked choice (#916)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… picked (#916)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…een time pill (#916)

The same look as a running row on the Tickets list, in place of the Stop
timer button with its time under it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…uttons (#916)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@SarkarShubhdeep SarkarShubhdeep self-assigned this Dec 3, 2026
SarkarShubhdeep and others added 11 commits December 3, 2026 16:02
…y source (#916)

timers.getTicketTotals takes { source, ticketId } refs and keys its totals
source:ticketId. A Redmine issue's total includes time on TimeHuddle tickets
while linked to it, as on its page. Rows on All tickets and My Board show the
total as an outlined timer chip; the timer's Resume tooltip now covers Redmine
rows too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…916)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…it was updated (#916)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…d rounds it (#916)

A Redmine issue's total, and the part of a TimeHuddle ticket's that went to a
linked issue, count each day rounded up to the step the organization set for
the user's Redmine server. The rows' chip, the ticket page's header and the
Resume label then show what Redmine gets, before it is sent.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…is TimeHuddle didn't send (#916)

Time logged in Redmine itself, or sent by another TimeHuddle, on the ticket's
Redmine issue (or the one it is linked to) is read live with user_id=me, less
the entries this TimeHuddle's ledger sent, and added to the header's total and
the Resume label. Rows' chips still count TimeHuddle time only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e didn't send (#916)

Your newest 500 Redmine entries are read once (cached five minutes, busted by
a send) and matched to the list's Redmine issues and linked tickets, less the
entries this TimeHuddle sent. The ticket page's total reads the same.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Brings in #844's Billable dropdown. clock.js and redmine.js conflicted only
in their imports: both sides' are kept.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ote for #920 (#916)

Integration tests against a stand-in Redmine: a Redmine issue's day rounds up
to the organization's step, a linked ticket rounds only what went to its issue,
your own Redmine-only entries are added and a sent entry isn't counted twice,
and a ticket's page agrees with its row.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…am (#916)

Test users now start on their Personal team, and the timesheet shows only the
selected team's shifts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…he issue and day (#916)

Redmine has no /issues/:id/time_entries page (404 on redmine0); its
/time_entries list takes issue_id, user_id and spent_on filters.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…916)

At clock-out each line linking a ticket ends with that ticket's time this
session as an inline-code chip: the total of its runs, a running one counted
to the press. Written into the post then; a ticket under a minute gets none.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@SarkarShubhdeep
SarkarShubhdeep marked this pull request as ready for review December 3, 2026 22:36
Copilot AI balanced review requested due to automatic review settings December 3, 2026 22:36

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Unresolved defects can misreport rounded and unsent time, display stale or mismatched ticket totals, hide timesheet entries, and trigger excessive database queries.

10 open issues
What changed in this PR

Adds personal ticket-time totals and Redmine send status to existing ticket and timesheet views, addressing #916 without adding a new screen.

Changes:

  • Shows logged-time badges and Resume timer labels.
  • Adds Redmine receipts, rounded totals, and externally logged time.
  • Groups timesheet sessions by ticket and adds source filtering.
File Description
tests/​e2e/​timers/​ticket-time-log.spec.ts Covers ticket totals, receipts, and timesheet rows.
src/​lib/​api.ts Adds receipt types and bulk totals API.
src/​features/​timers/​timeLogStrings.ts Centralizes time-log text.
src/​features/​timers/​ticketTimerStrings.ts Removes unused stop label.
src/​features/​timers/​RedmineReceiptNote.tsx Renders receipt status and links.
src/​features/​timers/​redmineReceipt.ts Builds receipt display text.
src/​features/​timers/​redmineReceipt.test.ts Tests receipt formatting.
src/​features/​tickets/​useMyTicketTotals.ts Loads totals in batches.
src/​features/​tickets/​TicketRow.tsx Displays totals and Resume labels.
src/​features/​tickets/​TicketList.tsx Supplies row totals.
src/​features/​tickets/​detail/​TicketQuickActions.tsx Updates timer controls and labels.
src/​features/​tickets/​detail/​TicketDetailPage.tsx Loads and displays personal totals.
src/​features/​tickets/​detail/​TicketActivityCard.tsx Displays session receipts.
src/​features/​tickets/​detail/​README.md Documents time totals and receipts.
src/​features/​tickets/​detail/​activityEntries.ts Attaches receipts to activity entries.
src/​features/​tickets/​detail/​activityEntries.test.ts Tests session receipt mapping.
src/​features/​clock/​timesheetSources.ts Resolves sources and filters shifts.
src/​features/​clock/​timesheetSources.test.ts Tests source resolution and filtering.
src/​features/​clock/​TimesheetSourceFilter.tsx Adds source-selection menu.
src/​features/​clock/​TimesheetSourceFilter.test.tsx Tests source selection.
src/​features/​clock/​TimesheetRow.tsx Displays grouped ticket time and receipts.
src/​features/​clock/​TimesheetRow.test.tsx Tests grouped ticket rows.
src/​features/​clock/​shiftTicketRows.ts Groups sessions by ticket.
src/​features/​clock/​shiftTicketRows.test.ts Tests grouping and receipt deduplication.
src/​features/​clock/​PersonalTimesheetPanel.tsx Integrates source filtering.
meteor-backend/​tests/​timers.test.ts Tests bulk totals and caller scoping.
meteor-backend/​tests/​redmine-receipts-core.test.ts Tests receipt construction.
meteor-backend/​server/​timers.js Adds bulk totals and session receipts.
meteor-backend/​server/​timer-core.js Includes session date and linked issue.
meteor-backend/​server/​redmine.js Calculates rounding and external-time totals.
meteor-backend/​server/​redmine-time-sync.js Supports caller-wide sent-entry lookup.
meteor-backend/​server/​redmine-time-entries.js Exports minute-rounding helper.
meteor-backend/​server/​redmine-receipts.js Loads and attaches receipts.
meteor-backend/​server/​redmine-receipts-core.js Builds issue-day receipts and URLs.
meteor-backend/​server/​redmine-client.js Reads the caller’s Redmine entries.
meteor-backend/​server/​main.js Exposes bulk totals endpoint.
meteor-backend/​server/​clock.js Adds receipts to personal timesheets.

Review effort: Balanced

Comment thread meteor-backend/server/redmine.js Resolved
Comment thread meteor-backend/server/redmine.js Resolved
Comment thread meteor-backend/server/timers.js Resolved
SarkarShubhdeep and others added 5 commits December 4, 2026 11:18
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ows the time (#916)

The Resume wording stays on the ticket's own page.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
)

A ticket's logged time shows Redmine-bound time as Redmine gets it. A day
marked Never send never reaches Redmine, so its time is left out before
rounding, with the same formula the send uses (owedMinutes), now shared.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A run of a few seconds showed as a "0m" chip on the row, the ticket page's
badge and its Resume label. One helper, formatLoggedTime, now hides it at all three.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…en (#916)

Never send lowers a ticket's logged time, and a send turns "not sent yet"
into "Sent" in its Activity. Both send paths now announce tickets:refetch,
which the rows, the ticket page and its Activity already reload on.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings December 4, 2026 18:04

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Comment thread meteor-backend/server/redmine.js Resolved
Comment thread meteor-backend/server/redmine.js Resolved
Comment thread meteor-backend/server/redmine.js Resolved
- Receipts call time waiting only when the Send would offer it, with the
  Send's rounding steps: a minute already covered by a rounded-up entry is
  not "not sent yet".
- The timesheet's source filter names other organizations' sources when no
  team is picked, and drops picks that a team change took away.
- The ticket page keeps only its latest time read, so another ticket's late
  answer never lands.
- Pull-to-refresh on Tickets reloads the logged time with the tickets.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings December 4, 2026 18:14
Redmine reports whole-minute entries as two-decimal hours, so five 1-minute
entries (0.02 h each) added up to 6m. Whole minutes are recovered first, as
the send ledger already does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

Unresolved rounding and discard-allocation errors produce inconsistent ticket totals, while receipt loading introduces unbounded database query fan-out.

No open issues 🎉

2 previously missed issues

In code that hasn't changed since last review

Medium severity Recover whole minutes before converting Redmine hours

meteor-backend/​server/​redmine.js:481

Redmine reports whole-minute entries as two-decimal hours, so multiplying those hours directly by 3600 accumulates rounding errors. For example, five 7-minute entries are returned as 0.12 h each and become 36 minutes here instead of 35. Recover whole minutes from each entry before converting to seconds, as pushLedgerFor already does.

Medium severity Match Redmine servers by hostname consistently

src/​features/​clock/​timesheetSources.ts:37

URL.host includes a non-default port, but the source registry stores URL.hostname (meteor-backend/server/ticket-ids.js:54–59). A registered server such as https://redmine.example.org:8443 therefore never matches here, and the filter displays “Redmine” instead of its registered identifier. Compare hostnames consistently.

12 resolved since last review

Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings December 4, 2026 18:21

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

Human assessment is needed to evaluate multiple unpublished findings affecting Redmine server matching and sent-time accounting accuracy.

No open issues 🎉

Review effort: Balanced

@Dharp02

Dharp02 commented Dec 4, 2026

Copy link
Copy Markdown
Collaborator

@SarkarShubhdeep, a question on the Tickets list timer button.

#916 asks that a ticket with time logged show its timer as a continuation, e.g. "Resume · 2h 10m", on the detail page and in the Tickets list. In this PR the detail page does that, but in the Tickets list the button keeps its plain label and the time shows as a chip on the row instead (commit "a row's timer button keeps its plain label; the chip shows…").

Can you explain why you went with the chip for the list rather than the Resume label? If it's intentional, we should update the criterion in #916 to match.

@SarkarShubhdeep

Copy link
Copy Markdown
Collaborator Author

@Dharp02 Good catch, thanks. The wording in #916 was wrong: Resume was only ever meant for the ticket detail page, never the Tickets list.

In the list, the timer is a small icon-only play button, so there's no room for "Resume · 2h 10m". Instead, each row shows the logged time as a chip on its top line, and the play button keeps its plain label. The detail page keeps "Resume · 2h 10m".

I've corrected the description and the acceptance criterion in #916 to match.

@Dharp02 Dharp02 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Approving.

@SarkarShubhdeep
SarkarShubhdeep merged commit f5bc6f7 into main Dec 4, 2026
16 checks passed
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.

Show Time Worked on Each Ticket and What Was Sent to Redmine

3 participants