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-18645 main #12025

Merged
merged 18 commits into from
Feb 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
8f3a293
grade moved to orders, can view curr grade in Edit orders but edit no…
traskowskycaci Feb 13, 2024
aca41d0
grade moved to orders, can view curr grade in Edit orders but edit no…
traskowskycaci Feb 13, 2024
5186ecc
Merge branch 'main' into B-18645-Move-grade-to-Orders-From-Allowances…
traskowskycaci Feb 13, 2024
f4313bb
Merge branch 'main' into B-18645-Move-grade-to-Orders-From-Allowances…
traskowskycaci Feb 13, 2024
704b787
works for editing grade but needs error handling
traskowskycaci Feb 14, 2024
aae74d7
editing of grade works for too and counselor
traskowskycaci Feb 15, 2024
c8c33b6
Merge branch 'main' into B-18645-Move-grade-to-Orders-From-Allowances…
traskowskycaci Feb 15, 2024
13a5183
make main match int - fix order_updater int commit
traskowskycaci Feb 15, 2024
18f8738
modify update orders for playwright
traskowskycaci Feb 15, 2024
b3a7a4d
remove extra fluff
traskowskycaci Feb 16, 2024
6b80f95
wrapped call to GetWeightAllotment in nil check
traskowskycaci Feb 20, 2024
1e5fabd
Merge branch 'main' into B-18645-Move-grade-to-Orders-From-Allowances…
traskowskycaci Feb 20, 2024
c83d3b6
Merge branch 'main' into B-18645-Move-grade-to-Orders-From-Allowances…
traskowskycaci Feb 21, 2024
bdab0a0
Merge branch 'main' into B-18645-Move-grade-to-Orders-From-Allowances…
traskowskycaci Feb 22, 2024
5eb4de6
Merge branch 'main' into B-18645-Move-grade-to-Orders-From-Allowances…
traskowskycaci Feb 22, 2024
0c37981
Merge branch 'main' into B-18645-Move-grade-to-Orders-From-Allowances…
traskowskycaci Feb 26, 2024
d8abd64
Merge branch 'main' into B-18645-Move-grade-to-Orders-From-Allowances…
traskowskycaci Feb 26, 2024
66861ee
Merge branch 'main' into B-18645-Move-grade-to-Orders-From-Allowances…
traskowskycaci Feb 27, 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
12 changes: 12 additions & 0 deletions pkg/gen/ghcapi/embedded_spec.go

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

51 changes: 51 additions & 0 deletions pkg/gen/ghcmessages/counseling_update_order_payload.go

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

51 changes: 51 additions & 0 deletions pkg/gen/ghcmessages/update_order_payload.go

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

26 changes: 26 additions & 0 deletions pkg/services/order/order_updater.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,19 @@ func orderFromTOOPayload(_ appcontext.AppContext, existingOrder models.Order, pa
order.AmendedOrdersAcknowledgedAt = &acknowledgedAt
}

if payload.Grade != nil {
order.Grade = (*internalmessages.OrderPayGrade)(payload.Grade)
// Calculate new DBWeightAuthorized based on the new grade
weightAllotment := models.GetWeightAllotment(*order.Grade)
weight := weightAllotment.TotalWeightSelf
// Payload does not have this information, retrieve dependents from the existing order
if existingOrder.HasDependents && *order.Entitlement.DependentsAuthorized {
// Only utilize dependent weight authorized if dependents are both present and authorized
weight = weightAllotment.TotalWeightSelfPlusDependents
}
order.Entitlement.DBAuthorizedWeight = &weight
}

return order
}

Expand Down Expand Up @@ -348,6 +361,19 @@ func orderFromCounselingPayload(existingOrder models.Order, payload ghcmessages.
order.OrdersType = internalmessages.OrdersType(*payload.OrdersType)
}

if payload.Grade != nil {
order.Grade = (*internalmessages.OrderPayGrade)(payload.Grade)
// Calculate new DBWeightAuthorized based on the new grade
weightAllotment := models.GetWeightAllotment(*order.Grade)
weight := weightAllotment.TotalWeightSelf
// Payload does not have this information, retrieve dependents from the existing order
if existingOrder.HasDependents && *order.Entitlement.DependentsAuthorized {
// Only utilize dependent weight authorized if dependents are both present and authorized
weight = weightAllotment.TotalWeightSelfPlusDependents
}
order.Entitlement.DBAuthorizedWeight = &weight
}

return order
}

Expand Down
3 changes: 3 additions & 0 deletions pkg/services/order/order_updater_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,7 @@ func (suite *OrderServiceSuite) TestUpdateOrderAsCounselor() {
reportByDate := strfmt.Date(time.Now().Add(72 * time.Hour))
deptIndicator := ghcmessages.DeptIndicatorCOASTGUARD
ordersTypeDetail := ghcmessages.OrdersTypeDetail("INSTRUCTION_20_WEEKS")
grade := ghcmessages.GradeO5

body := ghcmessages.CounselingUpdateOrderPayload{
IssueDate: &dateIssued,
Expand All @@ -449,6 +450,7 @@ func (suite *OrderServiceSuite) TestUpdateOrderAsCounselor() {
OrdersTypeDetail: &ordersTypeDetail,
Tac: handlers.FmtString("E19A"),
Sac: nullable.NewString("987654321"),
Grade: &grade,
}

eTag := etag.GenerateEtag(order.UpdatedAt)
Expand All @@ -471,6 +473,7 @@ func (suite *OrderServiceSuite) TestUpdateOrderAsCounselor() {
suite.EqualValues(body.DepartmentIndicator, updatedOrder.DepartmentIndicator)
suite.EqualValues(body.Tac, updatedOrder.TAC)
suite.EqualValues(body.Sac.Value, updatedOrder.SAC)
suite.Equal(*updatedOrder.Entitlement.DBAuthorizedWeight, 16000)
})

suite.Run("Rolls back transaction if Order is invalid", func() {
Expand Down
5 changes: 2 additions & 3 deletions playwright/tests/office/qaecsr/csrFlows.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ test.describe('Customer Support User Flows', () => {
await expect(page.locator('select[name="ordersTypeDetail"]')).toBeDisabled();
await expect(page.locator('input[name="tac"]')).toBeDisabled();
await expect(page.locator('input[name="sac"]')).toBeDisabled();
await expect(page.locator('select[name="payGrade"]')).toBeDisabled();
// no save button should exist
await expect(page.getByRole('button', { name: 'Save' })).toHaveCount(0);
});
Expand All @@ -157,11 +158,9 @@ test.describe('Customer Support User Flows', () => {
await expect(page.locator('input[name="storageInTransit"]')).toBeDisabled();
await expect(page.locator('input[name="organizationalClothingAndIndividualEquipment"]')).toBeDisabled();

// read only grade and authorized weight
// read only authorized weight
await expect(page.locator('select[name=agency]')).toBeDisabled();
await expect(page.locator('select[name=agency]')).toBeDisabled();
await expect(page.locator('select[name="grade"]')).toBeDisabled();
await expect(page.locator('select[name="grade"]')).toBeDisabled();
await expect(page.locator('input[name="dependentsAuthorized"]')).toBeDisabled();

// no save button should exist
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { EntitlementShape } from 'types/order';
import { formatWeight } from 'utils/formatters';
import Hint from 'components/Hint';

const AllowancesDetailForm = ({ header, entitlements, payGradeOptions, branchOptions, formIsDisabled }) => {
const AllowancesDetailForm = ({ header, entitlements, branchOptions, formIsDisabled }) => {
return (
<div className={styles.AllowancesDetailForm}>
{header && <h3 data-testid="header">{header}</h3>}
Expand Down Expand Up @@ -71,15 +71,6 @@ const AllowancesDetailForm = ({ header, entitlements, payGradeOptions, branchOpt
showDropdownPlaceholderText={false}
isDisabled={formIsDisabled}
/>
<DropdownInput
data-testid="payGradeInput"
name="grade"
label="Pay grade"
id="payGradeInput"
options={payGradeOptions}
showDropdownPlaceholderText={false}
isDisabled={formIsDisabled}
/>
<MaskedTextField
data-testid="sitInput"
defaultValue="0"
Expand Down Expand Up @@ -121,7 +112,6 @@ const AllowancesDetailForm = ({ header, entitlements, payGradeOptions, branchOpt

AllowancesDetailForm.propTypes = {
entitlements: EntitlementShape.isRequired,
payGradeOptions: DropdownArrayOf.isRequired,
branchOptions: DropdownArrayOf.isRequired,
header: PropTypes.string,
formIsDisabled: PropTypes.bool,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,18 +47,6 @@ jest.mock('formik', () => ({

const { Formik } = jest.requireActual('formik');

const payGradeOptions = [
{ key: 'E_1', value: 'E-1' },
{ key: 'E_2', value: 'E-2' },
{ key: 'E_3', value: 'E-3' },
{ key: 'E_4', value: 'E-4' },
{ key: 'E_5', value: 'E-5' },
{ key: 'E_6', value: 'E-6' },
{ key: 'E_7', value: 'E-7' },
{ key: 'E_8', value: 'E-8' },
{ key: 'E_9', value: 'E-9' },
];

const branchOptions = [
{ key: 'Army', value: 'Army' },
{ key: 'Navy', value: 'Navy' },
Expand All @@ -83,11 +71,7 @@ describe('AllowancesDetailForm', () => {
it('renders the form', async () => {
render(
<Formik initialValues={initialValues}>
<AllowancesDetailForm
entitlements={entitlements}
payGradeOptions={payGradeOptions}
branchOptions={branchOptions}
/>
<AllowancesDetailForm entitlements={entitlements} branchOptions={branchOptions} />
</Formik>,
);

Expand All @@ -99,11 +83,7 @@ describe('AllowancesDetailForm', () => {
it('renders the pro-gear hints', async () => {
render(
<Formik initialValues={initialValues}>
<AllowancesDetailForm
entitlements={entitlements}
payGradeOptions={payGradeOptions}
branchOptions={branchOptions}
/>
<AllowancesDetailForm entitlements={entitlements} branchOptions={branchOptions} />
</Formik>,
);

Expand All @@ -114,12 +94,7 @@ describe('AllowancesDetailForm', () => {
it('renders the title header', async () => {
render(
<Formik initialValues={initialValues}>
<AllowancesDetailForm
entitlements={entitlements}
payGradeOptions={payGradeOptions}
branchOptions={branchOptions}
header="Test Header"
/>
<AllowancesDetailForm entitlements={entitlements} branchOptions={branchOptions} header="Test Header" />
</Formik>,
);

Expand Down
Loading
Loading