Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

B 21941 main v3 #14812

Merged
merged 32 commits into from
Feb 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
59b2821
easier to read changes
traskowskycaci Dec 23, 2024
e6a361b
removing moves.status query
traskowskycaci Dec 23, 2024
2f00fd4
removing moves.status query
traskowskycaci Dec 23, 2024
4a57040
FINALLY
traskowskycaci Dec 24, 2024
d65894e
test updates
traskowskycaci Dec 24, 2024
f572ddf
fix queue handler test
traskowskycaci Dec 24, 2024
2749f62
remove comments
traskowskycaci Dec 26, 2024
2bbb3dc
nicer formatting for AND
traskowskycaci Dec 26, 2024
b2b9e78
add additional origin service item reservice codes
traskowskycaci Dec 26, 2024
37849ff
update test to use search
traskowskycaci Jan 3, 2025
bea2ee0
include DOPSIT
traskowskycaci Jan 3, 2025
5d7b9df
refactor into base query plus additional loc query if needed
traskowskycaci Jan 3, 2025
4fe3bd6
whoops get back in there DOPSIT
traskowskycaci Jan 3, 2025
e5c31b8
remove nonexistest reservice code
traskowskycaci Jan 3, 2025
77e66f5
update move status for test
traskowskycaci Jan 6, 2025
5e57d2b
add comment and update function name
traskowskycaci Jan 7, 2025
e06b961
update query to account for UB excess weight warning needing review
traskowskycaci Jan 13, 2025
25b666d
Revert "update query to account for UB excess weight warning needing …
traskowskycaci Jan 13, 2025
bbd2951
update query to consider UB excess weight risk
traskowskycaci Jan 13, 2025
59651d5
yay plz be nice to me query
traskowskycaci Jan 15, 2025
dad02a1
update and expand tests
traskowskycaci Jan 15, 2025
0e76233
tidy up those test comments
traskowskycaci Jan 16, 2025
10f4e68
anotha version of the query and even more tests
traskowskycaci Jan 16, 2025
522c15e
add test coverage for pkg/unit/millicents
traskowskycaci Jan 17, 2025
53be9ee
update query and tests to account for new SIT extension logic
traskowskycaci Feb 13, 2025
b8e55ba
add comment update for extensions
traskowskycaci Feb 13, 2025
e50d18c
Merge branch 'main' into B-21941-MAIN-v3
traskowskycaci Feb 19, 2025
c88f5ae
Merge branch 'main' into B-21941-MAIN-v3
traskowskycaci Feb 19, 2025
1c869fd
Merge branch 'main' into B-21941-MAIN-v3
traskowskycaci Feb 19, 2025
4f33ec6
Merge branch 'main' into B-21941-MAIN-v3
traskowskycaci Feb 19, 2025
b1e29d8
Merge branch 'main' into B-21941-MAIN-v3
traskowskycaci Feb 19, 2025
4bc06b5
Merge branch 'main' into B-21941-MAIN-v3
traskowskycaci Feb 19, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions pkg/handlers/ghcapi/queues_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,11 @@ func (suite *HandlerSuite) TestGetMoveQueuesHandlerFilters() {
Status: models.MTOServiceItemStatusSubmitted,
},
},
{
Model: models.ReService{
Code: models.ReServiceCodeDOFSIT,
},
},
}, nil)

// Service Counseling Completed Move
Expand Down
95 changes: 94 additions & 1 deletion pkg/services/order/order_fetcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,9 @@ func (f orderFetcher) ListOrders(appCtx appcontext.AppContext, officeUserID uuid
tooAssignedUserQuery := tooAssignedUserFilter(params.TOOAssignedUser)
sortOrderQuery := sortOrder(params.Sort, params.Order, ppmCloseoutGblocs)
counselingQuery := counselingOfficeFilter(params.CounselingOffice)
tooDestinationRequestsQuery := tooQueueOriginRequestsFilter(role)
// Adding to an array so we can iterate over them and apply the filters after the query structure is set below
options := [20]QueryOption{branchQuery, locatorQuery, dodIDQuery, emplidQuery, customerNameQuery, originDutyLocationQuery, destinationDutyLocationQuery, moveStatusQuery, gblocQuery, submittedAtQuery, appearedInTOOAtQuery, requestedMoveDateQuery, ppmTypeQuery, closeoutInitiatedQuery, closeoutLocationQuery, ppmStatusQuery, sortOrderQuery, scAssignedUserQuery, tooAssignedUserQuery, counselingQuery}
options := [21]QueryOption{branchQuery, locatorQuery, dodIDQuery, emplidQuery, customerNameQuery, originDutyLocationQuery, destinationDutyLocationQuery, moveStatusQuery, gblocQuery, submittedAtQuery, appearedInTOOAtQuery, requestedMoveDateQuery, ppmTypeQuery, closeoutInitiatedQuery, closeoutLocationQuery, ppmStatusQuery, sortOrderQuery, scAssignedUserQuery, tooAssignedUserQuery, counselingQuery, tooDestinationRequestsQuery}

var query *pop.Query
if ppmCloseoutGblocs {
Expand Down Expand Up @@ -895,3 +896,95 @@ func sortOrder(sort *string, order *string, ppmCloseoutGblocs bool) QueryOption
}
}
}

// We want to filter out any moves that have ONLY destination type requests to them, such as destination SIT, shuttle, out of the
// task order queue. If the moves have origin SIT, excess weight risks, or sit extensions with origin SIT service items, they
// should still appear in the task order queue, which is what this query looks for
func tooQueueOriginRequestsFilter(role roles.RoleType) QueryOption {
return func(query *pop.Query) {
if role == roles.RoleTypeTOO {
baseQuery := `
-- check for moves with destination requests and NOT origin requests, then return the inverse for the TOO queue with the NOT wrapped around the query
NOT (
-- check for moves with destination requests
(
-- moves with submitted destination SIT or shuttle submitted service items
EXISTS (
SELECT 1
FROM mto_service_items msi
JOIN re_services rs ON msi.re_service_id = rs.id
WHERE msi.mto_shipment_id = mto_shipments.id
AND msi.status = 'SUBMITTED'
AND rs.code IN ('DDFSIT', 'DDASIT', 'DDDSIT', 'DDSHUT', 'DDSFSC',
'IDFSIT', 'IDASIT', 'IDDSIT', 'IDSHUT', 'IDSFSC')
)
-- requested shipment address update
OR EXISTS (
SELECT 1
FROM shipment_address_updates sau
WHERE sau.shipment_id = mto_shipments.id
AND sau.status = 'REQUESTED'
)
-- Moves with SIT extensions and ONLY destination SIT service items we filter out of TOO queue
OR (
EXISTS (
SELECT 1
FROM sit_extensions se
JOIN mto_service_items msi ON se.mto_shipment_id = msi.mto_shipment_id
JOIN re_services rs ON msi.re_service_id = rs.id
WHERE se.mto_shipment_id = mto_shipments.id
AND se.status = 'PENDING'
AND rs.code IN ('DDFSIT', 'DDASIT', 'DDDSIT', 'DDSHUT', 'DDSFSC',
'IDFSIT', 'IDASIT', 'IDDSIT', 'IDSHUT', 'IDSFSC')
)
-- make sure there are NO origin SIT service items (otherwise, it should be in both queues)
AND NOT EXISTS (
SELECT 1
FROM mto_service_items msi
JOIN re_services rs ON msi.re_service_id = rs.id
WHERE msi.mto_shipment_id = mto_shipments.id
AND msi.status = 'SUBMITTED'
AND rs.code IN ('ICRT', 'IUBPK', 'IOFSIT', 'IOASIT', 'IOPSIT', 'IOSHUT',
'IHUPK', 'IUCRT', 'DCRT', 'MS', 'CS', 'DOFSIT', 'DOASIT',
'DOPSIT', 'DOSFSC', 'IOSFSC', 'DUPK', 'DUCRT', 'DOSHUT',
'FSC', 'DMHF', 'DBTF', 'DBHF', 'IBTF', 'IBHF', 'DCRTSA',
'DLH', 'DOP', 'DPK', 'DSH', 'DNPK', 'INPK', 'UBP',
'ISLH', 'POEFSC', 'PODFSC', 'IHPK')
)
)
)
-- check for moves with origin requests or conditions where move should appear in TOO queue
AND NOT (
-- keep moves in the TOO queue with origin submitted service items
EXISTS (
SELECT 1
FROM mto_service_items msi
JOIN re_services rs ON msi.re_service_id = rs.id
WHERE msi.mto_shipment_id = mto_shipments.id
AND msi.status = 'SUBMITTED'
AND rs.code IN ('ICRT', 'IUBPK', 'IOFSIT', 'IOASIT', 'IOPSIT', 'IOSHUT',
'IHUPK', 'IUCRT', 'DCRT', 'MS', 'CS', 'DOFSIT', 'DOASIT',
'DOPSIT', 'DOSFSC', 'IOSFSC', 'DUPK', 'DUCRT', 'DOSHUT',
'FSC', 'DMHF', 'DBTF', 'DBHF', 'IBTF', 'IBHF', 'DCRTSA',
'DLH', 'DOP', 'DPK', 'DSH', 'DNPK', 'INPK', 'UBP',
'ISLH', 'POEFSC', 'PODFSC', 'IHPK')
)
-- keep moves in the TOO queue if they have an unacknowledged excess weight risk
OR (
(
moves.excess_weight_qualified_at IS NOT NULL
AND moves.excess_weight_acknowledged_at IS NULL
)
OR (
moves.excess_unaccompanied_baggage_weight_qualified_at IS NOT NULL
AND moves.excess_unaccompanied_baggage_weight_acknowledged_at IS NULL
)
)
)
)

`
query.Where(baseQuery)
}
}
}
Loading
Loading