Commit Graph
4 Commits
Author SHA1 Message Date
Lauri Ojansivu 570cc34552 Stopping a timer adds its time to the total, never replaces it.
Flowtime's Stop and Pomodoro's completed or stopped work interval read the
total on the client (getSpentTime()) and $set the sum. For a card that
links to a board or a card, that total is the linked document's, which can
still be on its way to the client: getSpentTime() then read null, and the
Stop replaced a linked board's 4 logged hours with the 1 hour of the
session (linked-timer-sessions.e2e.js failed 4 of 6 repeats). The session
length is now added on the server with addSpentTime(), an $inc on the same
spentTime field of the linked board, the linked card or the card. The
Flowtime and Pomodoro guards check addSpentTime and no longer pin
setSpentTime, and tests/linkedTimerSessions.test.cjs credits correctly
with no total on the client, pins the $inc targets, refuses a zero,
negative or non-number amount, and fails if a timer helper computes a total
from getSpentTime() again.

Thanks to xet7 !
2026-11-06 21:35:36 +02:00
Lauri Ojansivu 0bd4dc0a58 Keep linked timer sessions local and credit the current source total
Remove the duplicate spent-time setter that shadowed linked-board support. Await time credit before clearing sessions, and isolate automatic Pomodoro transitions from Tracker with one pending transition per view.

Thanks to xet7 !
2026-09-28 20:49:56 +03:00
Lauri Ojansivu aa728a8dce Give the Flowtime "Add Interruption" button the same theme as "Start Pomodoro".
Reported directly: on an opened card, "Add Interruption" rendered as an
unthemed default button next to "Start Pomodoro", which carries the
`.primary` theme class (as do "Start Flow" and every other primary action
button). The interruption button had no theme class at all. Added
`.primary`; tests/flowtimeSession.test.cjs now pins it.

Thanks to xet7 !
2026-09-11 10:01:11 +03:00
Lauri Ojansivu d8eee59e6f Add Flowtime session tracking to card time-tracking (#3919).
Unlike Pomodoro's fixed 25-minute work/break cycle, Flowtime has no fixed
interval: you start a work session and keep going as long as you are in
flow, tally interruptions as they happen without stopping the clock, and
stop the session when the flow naturally ends.

This integrates with WeKan's existing time-tracking feature
(client/components/cards/cardTime.js/.jade, models/cards.js
setSpentTime()/setIsOvertime()) rather than being a disconnected feature,
per the issue's own "related to Timetracking #812":

- models/cards.js gains three schema fields for the in-progress session -
  flowStartAt (Date), flowInterruptions (Number), flowUserId (String) -
  and startFlowSession()/addFlowInterruption()/stopFlowSession() helpers
  that mirror the shape of the existing setSpentTime()/setIsOvertime()
  helpers. Persisting server-side (not Session/localStorage) means a page
  reload does not lose an in-progress session.
- stopFlowSession() computes the session's duration and ADDS it, in hours,
  into the card's EXISTING spentTime field via the same setSpentTime()
  the manual time-entry popup already uses, then clears the session
  fields - Flowtime feeds the same total, it does not keep a separate one.
- addFlowInterruption() only increments the tally; it does not touch
  flowStartAt, so the clock keeps running through an interruption.
- client/components/cards/cardFlowtime.{js,jade,css} is the new card-detail
  UI: a Start Flow button, a live elapsed-time readout (Meteor.setInterval,
  the same idiom client/components/settings/problemsSummary.js already
  uses) with the running interruption count, an Add Interruption button,
  and Stop Flow. Only Utils.canModifyCard() may use the controls. Wired
  into client/components/cards/cardDetails.jade next to the existing
  cardSpentTime badge, and registered in client/features/cards.js the way
  every other client/components/cards/*.jade/js/css file is (Meteor does
  not auto-load them).
- Five new i18n keys (flowtime, flow-start, flow-stop,
  flow-add-interruption, flow-interruptions) added to en.i18n.json and
  given a real, direct translation - not an English placeholder - in
  every other locale file, in the same key position, with the %s
  placeholder preserved.

tests/flowtimeSession.test.cjs pins: the schema fields and helpers exist;
the manual time-entry popup is untouched; only start/interrupt/stop write
the flow fields, each scoped to this.getRealId() (no cross-card leakage);
stopFlowSession's arithmetic adds into, rather than replaces, spentTime;
the UI is wired and registered; and all locale files carry the new keys,
in order, with real (non-English) translations and the %s placeholder
intact.

Thanks to xet7 !

Closes #3919,
2026-09-10 19:04:09 +03:00