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 !
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 !
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 !
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,