mirror of
https://github.com/Sea-Haven-Industries/shoc-backend.git
synced 2026-09-30 03:43:11 +00:00
test(dashboard): pin drill-down rows for legacy open work orders
The parity test now also asserts which rows the drill-down lists: legacy open rows (status in Status or in LegacyStatus, or none) are listed and legacy closed, cancelled or assigned rows are not. Drops ticket keys from comments.
This commit is contained in:
parent
d6c5357fab
commit
702069f09c
4 changed files with 12 additions and 8 deletions
|
|
@ -12,7 +12,7 @@ using Xunit;
|
|||
namespace Api.SeaHavenIndustries.Tests;
|
||||
|
||||
/// <summary>
|
||||
/// SH-392: the Dashboard "Unassigned" count is open work orders with no
|
||||
/// The Dashboard "Unassigned" count is open work orders with no
|
||||
/// dispatcher in the selected period, and it equals the Work Orders list the
|
||||
/// tile drills into (GET /board/search, Dispatcher = Unassigned).
|
||||
/// </summary>
|
||||
|
|
@ -84,7 +84,8 @@ public class DashboardUnassignedTests
|
|||
Wo(15, inRange, status: null), // counted: no status at all
|
||||
Wo(16, inRange, status: null, legacyStatus: "Done", statusText: "Open"), // closed: LegacyStatus wins
|
||||
Wo(17, inRange, status: null, statusText: " Cancelled "), // canceled
|
||||
Wo(18, inRange, assignTo: "disp-1", status: null, statusText: "Open")); // assigned
|
||||
Wo(18, inRange, assignTo: "disp-1", status: null, statusText: "Open"), // assigned
|
||||
Wo(19, inRange, status: null, legacyStatus: "Open", statusText: "Done")); // counted: LegacyStatus wins
|
||||
ctx.SaveChanges();
|
||||
}
|
||||
|
||||
|
|
@ -141,9 +142,9 @@ public class DashboardUnassignedTests
|
|||
var allTime = await NewDashboard(ctx).GetStatsAsync(
|
||||
AccountUser(1), new DashboardStatsQueryDTO(), CancellationToken.None);
|
||||
|
||||
// 1, 2, 3 plus legacy 13, 14 and 15.
|
||||
inRange.Unassigned.Should().Be(6);
|
||||
allTime.Unassigned.Should().Be(8);
|
||||
// 1, 2, 3 plus legacy 13, 14, 15 and 19.
|
||||
inRange.Unassigned.Should().Be(7);
|
||||
allTime.Unassigned.Should().Be(9);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -241,5 +242,8 @@ public class DashboardUnassignedTests
|
|||
}, user, "admin-1");
|
||||
|
||||
stats.Unassigned.Should().Be(list.TotalCount);
|
||||
var listed = list.Items.Select(row => row.Id).ToList();
|
||||
listed.Should().Contain(new[] { 13, 14, 15, 19 });
|
||||
listed.Should().NotContain(new[] { 16, 17, 18 });
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ namespace SeaHaven.DataServices.Implementation
|
|||
query, new[] { "__unassigned__" }, myWorkOrders: false, currentUserId: null);
|
||||
query = WorkOrderBoardQueryFilters.ApplyStatusFilter(query, OpenLifecycleStatuses);
|
||||
// All time counts what the board lists with no range: every week plus
|
||||
// undated work, so the tile and its drill-down agree (SH-392).
|
||||
// undated work, so the tile and its drill-down agree.
|
||||
query = dateFrom is DateOnly from && dateTo is DateOnly to
|
||||
? WorkOrderBoardQueryFilters.ApplyDateRangeFilter(query, from, to)
|
||||
: WorkOrderBoardQueryFilters.ApplyDateRangeFilter(
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ namespace SeaHaven.DataServices.Interfaces
|
|||
|
||||
/// <summary>
|
||||
/// Open work orders with no dispatcher in the period, counted with the
|
||||
/// same filters as GET /board/search for Dispatcher=Unassigned (SH-392),
|
||||
/// same filters as GET /board/search for Dispatcher=Unassigned,
|
||||
/// so the Dashboard number matches the list it drills into.
|
||||
/// </summary>
|
||||
Task<int> CountOpenUnassignedAsync(
|
||||
|
|
|
|||
|
|
@ -106,7 +106,7 @@ namespace SeaHaven.Services.DTOs
|
|||
public int ScheduledTomorrow { get; set; }
|
||||
public int PendingUplifts { get; set; }
|
||||
public int AvetaPending { get; set; }
|
||||
/// <summary>Open work orders with no dispatcher in the selected period (SH-392).</summary>
|
||||
/// <summary>Open work orders with no dispatcher in the selected period.</summary>
|
||||
public int Unassigned { get; set; }
|
||||
public DashboardBreakdownDTO Breakdown { get; set; } = new();
|
||||
public int DueCount { get; set; }
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue