fix(allocations): fix behaviour of "active" dbTable-filter
This commit is contained in:
parent
f067f65ee5
commit
b694a093d5
@ -160,15 +160,13 @@ sortAllocationShorthand queryShorthand = singletonMap "allocation-short" . SortC
|
|||||||
|
|
||||||
fltrAllocationActive :: UTCTime -- ^ current time
|
fltrAllocationActive :: UTCTime -- ^ current time
|
||||||
-> OpticFilterColumn' t (Last Bool) (E.SqlExpr (E.Entity Allocation))
|
-> OpticFilterColumn' t (Last Bool) (E.SqlExpr (E.Entity Allocation))
|
||||||
fltrAllocationActive cTime queryAllocation = singletonMap "active" . FilterColumn $ view queryAllocation >>> anyFilter
|
fltrAllocationActive cTime queryAllocation = singletonMap "active" . FilterColumn $ \(view queryAllocation -> allocation) (Last criterion)
|
||||||
[ checkActive staffRegisterActive
|
-> maybe (const E.true) ((E.==.) . E.val) criterion $ E.or
|
||||||
, checkActive staffAllocationActive
|
[ staffRegisterActive allocation
|
||||||
, checkActive registerActive
|
, staffAllocationActive allocation
|
||||||
]
|
, registerActive allocation
|
||||||
|
]
|
||||||
where
|
where
|
||||||
checkActive doCheck allocation
|
|
||||||
= maybe E.true (\b -> E.val b E.==. doCheck allocation) . getLast
|
|
||||||
|
|
||||||
staffRegisterActive allocation
|
staffRegisterActive allocation
|
||||||
= E.maybe E.false (\f -> f E.<=. E.val cTime) (allocation E.^. AllocationStaffRegisterFrom)
|
= 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)
|
E.&&. E.maybe E.true (\t -> E.val cTime E.<=. t) (allocation E.^. AllocationStaffRegisterTo)
|
||||||
|
|||||||
Reference in New Issue
Block a user