Files
wekan/client/components/cards/cardFlowtime.css
T
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

21 lines
311 B
CSS

.card-flowtime {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 6px;
margin-top: 4px;
}
.flow-status {
display: flex;
gap: 8px;
align-items: center;
}
.flow-elapsed {
font-variant-numeric: tabular-nums;
font-weight: bold;
}
.flow-btn {
padding: 2px 8px;
border-radius: 4px;
}