diff --git a/src/Handler/Utils/Table/Columns.hs b/src/Handler/Utils/Table/Columns.hs index c8c7199fa..3fe114257 100644 --- a/src/Handler/Utils/Table/Columns.hs +++ b/src/Handler/Utils/Table/Columns.hs @@ -160,15 +160,13 @@ sortAllocationShorthand queryShorthand = singletonMap "allocation-short" . SortC fltrAllocationActive :: UTCTime -- ^ current time -> OpticFilterColumn' t (Last Bool) (E.SqlExpr (E.Entity Allocation)) -fltrAllocationActive cTime queryAllocation = singletonMap "active" . FilterColumn $ view queryAllocation >>> anyFilter - [ checkActive staffRegisterActive - , checkActive staffAllocationActive - , checkActive registerActive - ] +fltrAllocationActive cTime queryAllocation = singletonMap "active" . FilterColumn $ \(view queryAllocation -> allocation) (Last criterion) + -> maybe (const E.true) ((E.==.) . E.val) criterion $ E.or + [ staffRegisterActive allocation + , staffAllocationActive allocation + , registerActive allocation + ] where - checkActive doCheck allocation - = maybe E.true (\b -> E.val b E.==. doCheck allocation) . getLast - staffRegisterActive allocation = E.maybe E.false (\f -> f E.<=. E.val cTime) (allocation E.^. AllocationStaffRegisterFrom) E.&&. E.maybe E.true (\t -> E.val cTime E.<=. t) (allocation E.^. AllocationStaffRegisterTo)