Ordering of IT Staff in dashboard based on most active
This commit is contained in:
parent
db14ec3916
commit
1807dca57d
|
|
@ -243,7 +243,7 @@ final dashboardMetricsProvider = Provider<AsyncValue<DashboardMetrics>>((ref) {
|
|||
const triageWindow = Duration(minutes: 1);
|
||||
final triageCutoff = now.subtract(triageWindow);
|
||||
|
||||
final staffRows = staffProfiles.map((staff) {
|
||||
var staffRows = staffProfiles.map((staff) {
|
||||
final lastMessage = lastStaffMessageByUser[staff.id];
|
||||
final ticketsResponded = respondedTicketsByUser[staff.id]?.length ?? 0;
|
||||
final tasksClosed = tasksClosedByUser[staff.id]?.length ?? 0;
|
||||
|
|
@ -264,6 +264,15 @@ final dashboardMetricsProvider = Provider<AsyncValue<DashboardMetrics>>((ref) {
|
|||
);
|
||||
}).toList();
|
||||
|
||||
// Order IT staff by combined activity (tickets responded today + tasks closed today)
|
||||
// descending so most-active staff appear first. Use name as a stable tiebreaker.
|
||||
staffRows.sort((a, b) {
|
||||
final aCount = a.ticketsRespondedToday + a.tasksClosedToday;
|
||||
final bCount = b.ticketsRespondedToday + b.tasksClosedToday;
|
||||
if (bCount != aCount) return bCount.compareTo(aCount);
|
||||
return a.name.compareTo(b.name);
|
||||
});
|
||||
|
||||
return AsyncData(
|
||||
DashboardMetrics(
|
||||
newTicketsToday: ticketsToday.length,
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user