fix(programmer): buildMonitorEntries accepts pre-computed leave/passSlip maps
Changed buildMonitorEntries signature to accept Map<String, LeaveOfAbsence> and Map<String, PassSlip> instead of List types, matching the spec requirement that callers pass pre-computed maps from activeLeaveByUser() and activePassSlipByUser(). - Updated function signature for both parameters - Removed internal calls to activeLeaveByUser/activePassSlipByUser - Updated state-determination to use direct map lookups - Updated all test cases to pass computed maps - All 19 tests passing - No new analyzer issues Co-Authored-By: claude-flow <ruv@ruv.net>
This commit is contained in:
@@ -5,7 +5,6 @@ import 'package:tasq/models/programmer_task.model.dart';
|
||||
import 'package:tasq/models/programmer_task_work_log.model.dart';
|
||||
import 'package:tasq/providers/programmer_day_data_provider.dart';
|
||||
import 'package:tasq/utils/programmer_day_rows.dart';
|
||||
import 'package:tasq/utils/staff_presence.dart';
|
||||
|
||||
enum MonitorState { working, paused, idle, onLeave, passSlip }
|
||||
|
||||
@@ -99,20 +98,21 @@ class ProgrammerMonitorEntry {
|
||||
///
|
||||
/// Sort order: working -> paused -> idle -> passSlip -> onLeave,
|
||||
/// then alphabetical by programmer.fullName within each state group.
|
||||
///
|
||||
/// Parameters [leaves] and [passSlips] should be pre-computed maps from
|
||||
/// activeLeaveByUser() and activePassSlipByUser() respectively.
|
||||
List<ProgrammerMonitorEntry> buildMonitorEntries({
|
||||
required List<Profile> programmers,
|
||||
required DayActivityData today,
|
||||
required Map<String, ProgrammerRunInfo> runStates,
|
||||
required List<LeaveOfAbsence> leaves,
|
||||
required List<PassSlip> passSlips,
|
||||
required Map<String, LeaveOfAbsence> leaves,
|
||||
required Map<String, PassSlip> passSlips,
|
||||
required Map<String, String> sheetStatusByUser,
|
||||
required Map<String, String> projectNames,
|
||||
required Map<String, String> profileNames,
|
||||
required DateTime now,
|
||||
}) {
|
||||
final taskById = {for (final t in today.tasks) t.id: t};
|
||||
final activeLeaves = activeLeaveByUser(leaves, now);
|
||||
final activePassSlips = activePassSlipByUser(passSlips);
|
||||
|
||||
final entries = <ProgrammerMonitorEntry>[];
|
||||
|
||||
@@ -122,9 +122,9 @@ List<ProgrammerMonitorEntry> buildMonitorEntries({
|
||||
// Step 1: Determine state
|
||||
// Priority: onLeave > passSlip > working/paused/idle
|
||||
MonitorState state;
|
||||
if (activeLeaves.containsKey(programmerId)) {
|
||||
if (leaves.containsKey(programmerId)) {
|
||||
state = MonitorState.onLeave;
|
||||
} else if (activePassSlips.containsKey(programmerId)) {
|
||||
} else if (passSlips.containsKey(programmerId)) {
|
||||
state = MonitorState.passSlip;
|
||||
} else {
|
||||
// Determine from task states
|
||||
|
||||
Reference in New Issue
Block a user