Compare commits

..

1 commit

Author SHA1 Message Date
Alexandre Brandizzi
33179dbcab
Merge 4876fa2717 into f7db6b9f84 2026-09-24 21:35:39 -03:00
3 changed files with 2 additions and 20 deletions

View file

@ -152,9 +152,6 @@ 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(

View file

@ -5,14 +5,6 @@ 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));

View file

@ -61,15 +61,8 @@ namespace SeaHaven.DataServices.Implementation
query = WorkOrderBoardQueryFilters.ApplyDispatcherFilter(
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).
query = dateFrom is DateOnly from && dateTo is DateOnly to
? WorkOrderBoardQueryFilters.ApplyDateRangeFilter(query, from, to)
: WorkOrderBoardQueryFilters.ApplyDateRangeFilter(
query,
WorkOrderBoardQueryFilters.AllWeeksFrom,
WorkOrderBoardQueryFilters.AllWeeksTo,
includeDateless: true);
if (dateFrom is DateOnly from && dateTo is DateOnly to)
query = WorkOrderBoardQueryFilters.ApplyDateRangeFilter(query, from, to);
return await query.CountAsync(cancellationToken);
}