mirror of
https://github.com/Sea-Haven-Industries/shoc-backend.git
synced 2026-10-07 16:19:07 +00:00
Compare commits
2 commits
33179dbcab
...
49aa9fe204
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
49aa9fe204 | ||
|
|
7297e30212 |
3 changed files with 20 additions and 2 deletions
|
|
@ -152,6 +152,9 @@ public class DashboardUnassignedTests
|
|||
{
|
||||
using var ctx = NewContext();
|
||||
Seed(ctx);
|
||||
// Dated outside the board's all-weeks window: neither side may count them.
|
||||
ctx.workOrders.AddRange(Wo(11, new DateTime(1999, 12, 31)), Wo(12, new DateTime(2100, 1, 1)));
|
||||
ctx.SaveChanges();
|
||||
var user = AccountUser(1);
|
||||
|
||||
var stats = await NewDashboard(ctx).GetStatsAsync(
|
||||
|
|
|
|||
|
|
@ -5,6 +5,14 @@ namespace SeaHaven.DataServices.Helpers
|
|||
{
|
||||
public static class WorkOrderBoardQueryFilters
|
||||
{
|
||||
/// <summary>
|
||||
/// The window the Work Orders board searches when no date range is selected
|
||||
/// (client ADVANCED_SEARCH_ALL_WEEKS_FROM/TO), used with includeDateless.
|
||||
/// Counts that drill into that list use it too, so both see the same rows.
|
||||
/// </summary>
|
||||
public static readonly DateOnly AllWeeksFrom = new(2000, 1, 1);
|
||||
public static readonly DateOnly AllWeeksTo = new(2099, 12, 31);
|
||||
|
||||
public static IQueryable<WorkOrder> ApplyBaseScope(IQueryable<WorkOrder> query)
|
||||
=> query.Where(w => w.istemplate != true && (w.IsDeleted != true || w.IsDeleted == null));
|
||||
|
||||
|
|
|
|||
|
|
@ -61,8 +61,15 @@ namespace SeaHaven.DataServices.Implementation
|
|||
query = WorkOrderBoardQueryFilters.ApplyDispatcherFilter(
|
||||
query, new[] { "__unassigned__" }, myWorkOrders: false, currentUserId: null);
|
||||
query = WorkOrderBoardQueryFilters.ApplyStatusFilter(query, OpenLifecycleStatuses);
|
||||
if (dateFrom is DateOnly from && dateTo is DateOnly to)
|
||||
query = WorkOrderBoardQueryFilters.ApplyDateRangeFilter(query, from, to);
|
||||
// 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).
|
||||
query = dateFrom is DateOnly from && dateTo is DateOnly to
|
||||
? WorkOrderBoardQueryFilters.ApplyDateRangeFilter(query, from, to)
|
||||
: WorkOrderBoardQueryFilters.ApplyDateRangeFilter(
|
||||
query,
|
||||
WorkOrderBoardQueryFilters.AllWeeksFrom,
|
||||
WorkOrderBoardQueryFilters.AllWeeksTo,
|
||||
includeDateless: true);
|
||||
|
||||
return await query.CountAsync(cancellationToken);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue