bmc_hub/docs/WORK_DESK.md
Christian 1fb5b4a191 Add comprehensive tests for email and drift functionalities
- Introduced tests for drift operations UI and backend to ensure proper handling of ignore rules and UI elements.
- Added tests for email identity API to validate email linking and identity retrieval without updates.
- Implemented tests for email purchase link service to verify correct handling of purchase mail links and conflict scenarios.
- Created tests for email reply automation to ensure proper routing and processing of replies based on classification.
- Developed tests for email sender creation to validate suggestions and handling of existing contacts and companies.
- Added tests for email sender identity to ensure correct matching of contacts and domains.
- Implemented tests for work desk functionalities to validate task management, meeting registrations, and timer functionalities.
2026-11-03 01:16:12 +01:00

4.6 KiB
Raw Blame History

Min kø · Arbejdsbord

/planning?view=queue shows the personal desk selected in the design review. Other planning views and existing API responses are retained. No background operation starts a timer or turns planned work into actual time.

Behavior

  • Two-thirds of the page: today's assigned, unfinished work, including older outstanding work. Future-start work appears only if it has a booking/deadline on or before the displayed day. Closed cases remain excluded by the existing queue rules.
  • One-third: FullCalendar day view with separate Allokeret and Aftaler/registreret columns on one time axis. The default window follows the employee's configured weekday work schedule (07–17 when absent). Early/late entries extend the scrollable range, while the initial scroll stays at the workday start. Day navigation includes weekends. Bookings can move/resize in 15-minute increments; shared bookings retain their participants.
  • Recommended order: work that is not blocked first, then overdue deadlines, today's reservations, today's deadlines, and start/backlog. Exact deadline, next slot, priority, start and missing individual work break ties. Each task has a visible reason.
  • Personal estimates can be edited. A case-wide estimate is never silently assigned to one employee. Remaining work, future reserved time and missing planning remain separate.
  • Drag “Planlæg” onto a calendar time to reserve it immediately. Duration uses the unreserved remaining estimate, rounded up to 15 minutes; absent an estimate it uses the configured default. Conflict confirmation and Undo still apply. Clicking the button retains the detailed time dialog.
  • Manual ordering uses the existing queue positions and optimistic queue version. Recommended mode can be restored. Undo restores positions as well as the desk mode; stale versions never overwrite another change.
  • Primary case contact is displayed, with phone/mail actions. Existing visibility restrictions are retained.
  • Assignments added after migration appear in the inbox until acknowledged. Existing assignments are marked known on the first migration only.
  • Register time with an optional case, quickly register an already held internal meeting, or continue the most recent paused/stopped work. The internal-meeting shortcut offers 15/30/45/60 minute buttons, one or more employees and optional customer/contact pickers. It reuses registered quick-time, ends at the current time and creates no calendar booking. Without a customer, time is nonbillable internal work. Starting a new desk timer rejects an already active timer rather than silently replacing it.
  • Internal meeting attendance can be recorded after the meeting, with separate start/end for each actual participant. Existing time permissions are enforced. A unique event/employee link prevents duplicates; replay of identical data returns the existing entry, while changed data requires editing that entry.
  • Quick standalone time and case time are replay-safe via existing quick_time_batches. Planned meetings do not create actual time.
  • Undo is for the latest estimate/order/calendar mutation in the current page session. Time entries remain canonical and are edited through the existing time module.

Local activation and validation

  1. Back up the development schema.
  2. Apply migrations/1073_work_desk.sql in one transaction after migration 1070. It adds three columns and one unique index; no existing case/time records are removed. The inbox column is backfilled only on first creation.
  3. Restart the API and open /planning?view=queue.

The feature has been installed on the local development instance, not production. The local schema backup is in the ignored data/backups/work-desk-20261021/schema-before.sql.

Tests:

BMC_PLANNING_DB_TESTS=1 BMC_PLANNING_TEST_DATABASE=bmc_planning_test_20261017 PYTHONPYCACHEPREFIX=/tmp/bmc_desk_pycache ./.venv/bin/python -m pytest tests/test_work_desk.py tests/test_unified_planning.py -q
node --test tests/js/work-desk.test.cjs

Only use a disposable database whose name starts with bmc_planning_test_ for the opt-in integration tests. The fixture never substitutes the live development database.

Reversible rollout

Set WORK_DESK_ENABLED=false and restart the API to restore the original Min kø view. Leave migration 1073 in place: dropping the columns would discard inbox acknowledgements, the desk sort-mode preference and meeting-time links. Existing queue positions, events and time entries remain available to the original components.

“Find next available time” remains a later phase. It is not presented as an implemented scheduling feature.