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 19894 too queue moves int #13005

Merged
merged 24 commits into from
Jun 12, 2024
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
99ae483
set ListOrderParams.Status
traskowskycaci Jun 7, 2024
e128e8a
Merge branch 'main' into B-19894-TOO-queue-moves-MAIN
traskowskycaci Jun 7, 2024
80c4dbb
remove unnecessary filtering of status causing SC completed moves to …
traskowskycaci Jun 7, 2024
e369437
Merge branch 'B-19894-TOO-queue-moves-MAIN' into B-19894-TOO-queue-mo…
traskowskycaci Jun 10, 2024
8b303a9
remove enum vals from swagger
traskowskycaci Jun 10, 2024
4728eb3
add SC completed to filter
traskowskycaci Jun 10, 2024
b96bc35
Merge branch 'main' into B-19894-TOO-queue-moves-MAIN
traskowskycaci Jun 10, 2024
d5f23ef
Merge branch 'integrationTesting' into B-19894-TOO-queue-moves-INT
traskowskycaci Jun 10, 2024
9074965
Merge branch 'B-19894-TOO-queue-moves-MAIN' into B-19894-TOO-queue-mo…
traskowskycaci Jun 10, 2024
586ac4e
update queue and order fetcher tests
traskowskycaci Jun 11, 2024
143cc50
Merge branch 'B-19894-TOO-queue-moves-MAIN' into B-19894-TOO-queue-mo…
traskowskycaci Jun 11, 2024
66d12f4
Merge branch 'main' into B-19894-TOO-queue-moves-MAIN
traskowskycaci Jun 11, 2024
02fa094
update testharness data
traskowskycaci Jun 11, 2024
2e45d45
fix more playwright tests
traskowskycaci Jun 11, 2024
9bcfbe6
Merge branch 'B-19894-TOO-queue-moves-MAIN' into B-19894-TOO-queue-mo…
traskowskycaci Jun 11, 2024
8cf50ed
fix playwright tests for NTS
traskowskycaci Jun 11, 2024
587f1f7
Merge branch 'B-19894-TOO-queue-moves-MAIN' into B-19894-TOO-queue-mo…
traskowskycaci Jun 11, 2024
887fa4e
Merge branch 'integrationTesting' into B-19894-TOO-queue-moves-INT
traskowskycaci Jun 11, 2024
3a81c52
Merge branch 'integrationTesting' into B-19894-TOO-queue-moves-INT
danieljordan-caci Jun 12, 2024
3db70eb
Merge branch 'integrationTesting' into B-19894-TOO-queue-moves-INT
traskowskycaci Jun 12, 2024
7e0ed1f
reorder move status options
traskowskycaci Jun 12, 2024
cafc326
Merge branch 'B-19894-TOO-queue-moves-MAIN' into B-19894-TOO-queue-mo…
traskowskycaci Jun 12, 2024
504a294
add enum back in with correct move status values
traskowskycaci Jun 12, 2024
3009704
Merge branch 'integrationTesting' into B-19894-TOO-queue-moves-INT
traskowskycaci Jun 12, 2024
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
10 changes: 0 additions & 10 deletions pkg/gen/ghcapi/embedded_spec.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pkg/handlers/ghcapi/internal/payloads/model_to_payload.go
Original file line number Diff line number Diff line change
Expand Up @@ -1514,8 +1514,8 @@ func MTOServiceItemModel(s *models.MTOServiceItem, storer storage.FileStorer) *g
ConvertToCustomerExpense: *handlers.FmtBool(s.CustomerExpense),
CustomerExpenseReason: handlers.FmtStringPtr(s.CustomerExpenseReason),
SitDeliveryMiles: handlers.FmtIntPtrToInt64(s.SITDeliveryMiles),
StandaloneCrate: s.StandaloneCrate,
EstimatedPrice: handlers.FmtCost(s.PricingEstimate),
StandaloneCrate: s.StandaloneCrate,
}
}

Expand Down
5 changes: 5 additions & 0 deletions pkg/handlers/ghcapi/queues.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ func (h GetMovesQueueHandler) Handle(params queues.GetMovesQueueParams) middlewa
OrderType: params.OrderType,
}

// When no status filter applied, TOO should only see moves with status of New Move, Service Counseling Completed, or Approvals Requested
if params.Status == nil {
ListOrderParams.Status = []string{string(models.MoveStatusServiceCounselingCompleted), string(models.MoveStatusAPPROVALSREQUESTED), string(models.MoveStatusSUBMITTED)}
}
cameroncaci marked this conversation as resolved.
Show resolved Hide resolved

// Let's set default values for page and perPage if we don't get arguments for them. We'll use 1 for page and 20
// for perPage.
if params.Page == nil {
Expand Down
16 changes: 8 additions & 8 deletions pkg/handlers/ghcapi/queues_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -376,8 +376,8 @@ func (suite *HandlerSuite) TestGetMoveQueuesHandlerStatuses() {

suite.Equal(ghcmessages.MoveStatus("SUBMITTED"), result.Status)

// let's test for the Move approved status
hhgMove.Status = models.MoveStatusAPPROVED
// let's test for the ServiceCounselingCompleted status
hhgMove.Status = models.MoveStatusServiceCounselingCompleted
_, _ = suite.DB().ValidateAndSave(&hhgMove)

// Validate incoming payload: no body to validate
Expand All @@ -392,7 +392,7 @@ func (suite *HandlerSuite) TestGetMoveQueuesHandlerStatuses() {

result = payload.QueueMoves[0]

suite.Equal(ghcmessages.MoveStatus("APPROVED"), result.Status)
suite.Equal(ghcmessages.MoveStatus("SERVICE COUNSELING COMPLETED"), result.Status)

// Now let's test Approvals requested
hhgMove.Status = models.MoveStatusAPPROVALSREQUESTED
Expand Down Expand Up @@ -463,11 +463,11 @@ func (suite *HandlerSuite) TestGetMoveQueuesHandlerFilters() {
},
}, nil)

// Move approved
// Service Counseling Completed Move
factory.BuildMTOShipment(suite.DB(), []factory.Customization{
{
Model: models.Move{
Status: models.MoveStatusAPPROVED,
Status: models.MoveStatusServiceCounselingCompleted,
},
},
{
Expand Down Expand Up @@ -515,8 +515,8 @@ func (suite *HandlerSuite) TestGetMoveQueuesHandlerFilters() {
HTTPRequest: request,
Status: []string{
string(models.MoveStatusSUBMITTED),
string(models.MoveStatusAPPROVED),
string(models.MoveStatusAPPROVALSREQUESTED),
string(models.MoveStatusServiceCounselingCompleted),
},
}

Expand All @@ -540,8 +540,8 @@ func (suite *HandlerSuite) TestGetMoveQueuesHandlerFilters() {
HTTPRequest: request,
Status: []string{
string(models.MoveStatusSUBMITTED),
string(models.MoveStatusAPPROVED),
string(models.MoveStatusAPPROVALSREQUESTED),
string(models.MoveStatusServiceCounselingCompleted),
},
PerPage: models.Int64Pointer(1),
Page: models.Int64Pointer(1),
Expand Down Expand Up @@ -604,7 +604,7 @@ func (suite *HandlerSuite) TestGetMoveQueuesHandlerFilters() {
for _, move := range moves {
actualStatuses = append(actualStatuses, string(move.Status))
}
expectedStatuses := [3]string{"SUBMITTED", "APPROVED", "APPROVALS REQUESTED"}
expectedStatuses := [3]string{"SUBMITTED", "APPROVALS REQUESTED", "SERVICE COUNSELING COMPLETED"}

suite.EqualValues(3, payload.TotalCount)
suite.Len(payload.QueueMoves, 3)
Expand Down
11 changes: 2 additions & 9 deletions pkg/services/move/move_searcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,16 +156,9 @@ func destinationPostalCodeFilter(postalCode *string) QueryOption {

func moveStatusFilter(statuses []string) QueryOption {
return func(query *pop.Query) {
// If we have statuses let's use them
if len(statuses) > 0 {
var translatedStatuses []string
for _, status := range statuses {
if strings.EqualFold(status, string(models.MoveStatusSUBMITTED)) {
translatedStatuses = append(translatedStatuses, string(models.MoveStatusSUBMITTED), string(models.MoveStatusServiceCounselingCompleted))
} else {
translatedStatuses = append(translatedStatuses, status)
}
}
query.Where("moves.status in (?)", translatedStatuses)
query.Where("moves.status IN (?)", statuses)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is so much cleaner than the way it was done before, nice job!

}
}
}
Expand Down
14 changes: 1 addition & 13 deletions pkg/services/order/order_fetcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -371,19 +371,7 @@ func moveStatusFilter(statuses []string) QueryOption {
return func(query *pop.Query) {
// If we have statuses let's use them
if len(statuses) > 0 {
var translatedStatuses []string
for _, status := range statuses {
if strings.EqualFold(status, string(models.MoveStatusSUBMITTED)) {
translatedStatuses = append(translatedStatuses, string(models.MoveStatusSUBMITTED), string(models.MoveStatusServiceCounselingCompleted))
} else {
translatedStatuses = append(translatedStatuses, status)
}
}
query.Where("moves.status IN (?)", translatedStatuses)
}
// The TOO should never see moves that are in the following statuses: Draft, Canceled, Needs Service Counseling
if len(statuses) <= 0 {
query.Where("moves.status NOT IN (?)", models.MoveStatusDRAFT, models.MoveStatusCANCELED, models.MoveStatusNeedsServiceCounseling)
query.Where("moves.status IN (?)", statuses)
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/services/order/order_fetcher_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1828,7 +1828,7 @@ func (suite *OrderServiceSuite) TestListOrdersForTOOWithPPMWithDeletedShipment()
move := factory.BuildMove(suite.DB(), []factory.Customization{
{
Model: models.Move{
Status: models.MoveStatusAPPROVED,
Status: models.MoveStatusSUBMITTED,
},
},
}, nil)
Expand Down Expand Up @@ -1867,7 +1867,7 @@ func (suite *OrderServiceSuite) TestListOrdersForTOOWithPPMWithDeletedShipment()
}

orderFetcher := NewOrderFetcher()
moves, moveCount, err := orderFetcher.ListOrders(suite.AppContextWithSessionForTest(&session), tooOfficeUser.ID, &services.ListOrderParams{})
moves, moveCount, err := orderFetcher.ListOrders(suite.AppContextWithSessionForTest(&session), tooOfficeUser.ID, &services.ListOrderParams{Status: []string{string(models.MoveStatusSUBMITTED)}})
suite.FatalNoError(err)
suite.Equal(0, moveCount)
suite.Len(moves, 0)
Expand Down
6 changes: 3 additions & 3 deletions pkg/testdatagen/testharness/make_move.go
Original file line number Diff line number Diff line change
Expand Up @@ -4473,7 +4473,7 @@ func MakeHHGMoveInSIT(appCtx appcontext.AppContext) models.Move {
},
{
Model: models.Move{
Status: models.MoveStatusAPPROVED,
Status: models.MoveStatusAPPROVALSREQUESTED,
AvailableToPrimeAt: &now,
},
},
Expand Down Expand Up @@ -4739,7 +4739,7 @@ func MakeHHGMoveInSITWithPendingExtension(appCtx appcontext.AppContext) models.M
},
{
Model: models.Move{
Status: models.MoveStatusAPPROVED,
Status: models.MoveStatusAPPROVALSREQUESTED,
AvailableToPrimeAt: &now,
},
},
Expand Down Expand Up @@ -5124,7 +5124,7 @@ func MakeHHGMoveInSITEndsToday(appCtx appcontext.AppContext) models.Move {
},
{
Model: models.Move{
Status: models.MoveStatusAPPROVED,
Status: models.MoveStatusAPPROVALSREQUESTED,
AvailableToPrimeAt: &now,
},
},
Expand Down
3 changes: 2 additions & 1 deletion playwright/tests/office/txo/tooFlows.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -748,7 +748,8 @@ test.describe('TOO user', () => {

await page.locator('input[name="locator"]').type(shipmentAddressUpdate.Shipment.MoveTaskOrder.locator);
await page.locator('input[name="locator"]').blur();
await expect(page.getByText('Move approved')).toBeVisible();
// once the move is in the Move approved status, it will no longer show up in the TOO queue
await expect(page.getByText('Move approved')).not.toBeVisible();
await expect(page.getByText('Approvals requested')).not.toBeVisible();
});
});
23 changes: 20 additions & 3 deletions playwright/tests/office/txo/tooFlowsNTS.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ import { test, expect } from '../../utils/office/officeTest';

import { TooFlowPage } from './tooTestFixture';

const TOOTabsTitles = ['Move Queue', 'Search'];
const SearchRBSelection = ['Move Code', 'DOD ID', 'Customer Name'];

test.describe('TOO user', () => {
/** @type {TooFlowPage} */
let tooFlowPage;
Expand Down Expand Up @@ -170,19 +173,33 @@ test.describe('TOO user', () => {
});

test.describe('with approved HHG + NTS Move', () => {
let move;

test.beforeEach(async ({ officePage }) => {
const move = await officePage.testHarness.buildHHGMoveWithApprovedNTSShipmentsForTOO();
move = await officePage.testHarness.buildHHGMoveWithApprovedNTSShipmentsForTOO();
await officePage.signInAsNewTOOUser();
tooFlowPage = new TooFlowPage(officePage, move);
await officePage.tooNavigateToMove(move.locator);

const searchTab = officePage.page.getByTitle(TOOTabsTitles[1]);
await searchTab.click();
});

test('TOO can view and edit Domestic NTS Shipments handled by the Prime on the MTO page', async ({ page }) => {
// This test is almost exactly a duplicate of the test in
// tooFlowsNTSR.
const selectedRadio = page.getByRole('group').locator(`label:text("${SearchRBSelection[0]}")`);
await selectedRadio.click();
await page.getByTestId('searchText').type(move.locator);
await page.getByTestId('searchTextSubmit').click();

await expect(page.getByText('Results (1)')).toBeVisible();
await expect(page.getByTestId('locator-0')).toContainText(move.locator);

// await page.getByTestId('MoveTaskOrder-Tab').click();
await page.getByTestId('locator-0').click();

await page.getByTestId('MoveTaskOrder-Tab').click();
await tooFlowPage.waitForLoading();

await expect(
page.locator('[id="move-weights"] div').getByText('1 shipment not moved by GHC prime.'),
).not.toBeVisible();
Expand Down
23 changes: 21 additions & 2 deletions playwright/tests/office/txo/tooFlowsNTSR.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ import { test, expect } from '../../utils/office/officeTest';

import { TooFlowPage } from './tooTestFixture';

const TOOTabsTitles = ['Move Queue', 'Search'];
const SearchRBSelection = ['Move Code', 'DOD ID', 'Customer Name'];

test.describe('TOO user', () => {
/** @type {TooFlowPage} */
let tooFlowPage;
Expand Down Expand Up @@ -190,16 +193,32 @@ test.describe('TOO user', () => {
});

test.describe('with approved HHG + NTSR Move', () => {
let move;

test.beforeEach(async ({ officePage }) => {
const move = await officePage.testHarness.buildHHGMoveWithApprovedNTSRShipmentsForTOO();
move = await officePage.testHarness.buildHHGMoveWithApprovedNTSRShipmentsForTOO();
await officePage.signInAsNewTOOUser();
tooFlowPage = new TooFlowPage(officePage, move);
await officePage.tooNavigateToMove(move.locator);

const searchTab = officePage.page.getByTitle(TOOTabsTitles[1]);
await searchTab.click();
});

test('TOO can view and edit Domestic NTS-R Shipments handled by the Prime on the MTO page', async ({ page }) => {
// This test is almost exactly a duplicate of the test in
// tooFlowsNTS.

const selectedRadio = page.getByRole('group').locator(`label:text("${SearchRBSelection[0]}")`);
await selectedRadio.click();
await page.getByTestId('searchText').type(move.locator);
await page.getByTestId('searchTextSubmit').click();

await expect(page.getByText('Results (1)')).toBeVisible();
await expect(page.getByTestId('locator-0')).toContainText(move.locator);

// await page.getByTestId('MoveTaskOrder-Tab').click();
await page.getByTestId('locator-0').click();

await page.getByTestId('MoveTaskOrder-Tab').click();
await tooFlowPage.waitForLoading();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ const PPMProps = {
],
tableConfig: PPMReviewWeightsTableConfig,
};

const NonPPMProps = {
tableData: [
{
Expand Down
2 changes: 1 addition & 1 deletion src/constants/queues.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import MOVE_STATUSES from 'constants/moves';
export const MOVE_STATUS_OPTIONS = [
{ value: MOVE_STATUSES.SUBMITTED, label: 'New move' },
{ value: MOVE_STATUSES.APPROVALS_REQUESTED, label: 'Approvals requested' },
{ value: MOVE_STATUSES.APPROVED, label: 'Move approved' },
{ value: MOVE_STATUSES.SERVICE_COUNSELING_COMPLETED, label: 'Service Counseling Completed' },
];
traskowskycaci marked this conversation as resolved.
Show resolved Hide resolved

// Both moves that progressed straight from customer submission to the TOO
Expand Down
2 changes: 1 addition & 1 deletion src/pages/Office/MoveTaskOrder/MoveTaskOrder.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,8 @@ export const MoveTaskOrder = (props) => {
sitRequestedDelivery: item.sitRequestedDelivery,
sitDeliveryMiles: item.sitDeliveryMiles,
status: item.status,
standaloneCrate: item.standaloneCrate,
estimatedPrice: item.estimatedPrice,
standaloneCrate: item.standaloneCrate,
};

if (serviceItemsForShipment[`${newItem.mtoShipmentID}`]) {
Expand Down
14 changes: 5 additions & 9 deletions swagger-def/ghc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3205,10 +3205,6 @@ paths:
uniqueItems: true
items:
type: string
enum:
- SUBMITTED
- APPROVALS REQUESTED
- APPROVED
traskowskycaci marked this conversation as resolved.
Show resolved Hide resolved
- in: query
name: orderType
type: string
Expand Down Expand Up @@ -3548,15 +3544,15 @@ paths:
required: true
description: Parameter Name
responses:
"200":
'200':
description: Application Parameters
schema:
$ref: "#/definitions/ApplicationParameters"
"400":
$ref: '#/definitions/ApplicationParameters'
'400':
description: invalid request
"401":
'401':
description: request requires user authentication
"500":
'500':
description: server error
definitions:
ApplicationParameters:
Expand Down
4 changes: 0 additions & 4 deletions swagger/ghc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3335,10 +3335,6 @@ paths:
uniqueItems: true
items:
type: string
enum:
- SUBMITTED
- APPROVALS REQUESTED
- APPROVED
- in: query
name: orderType
type: string
Expand Down