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 21934 int #14553

Closed
wants to merge 19 commits into from
Closed

B 21934 int #14553

wants to merge 19 commits into from

Conversation

deandreJones
Copy link
Contributor

@deandreJones deandreJones commented Jan 9, 2025

B-21934

Summary

Is there anything you would like reviewers to give additional scrutiny?

this article explains more about the approach used.

Verification Steps for the Author

These are to be checked by the author.

  • Tested in the Experimental environment (for changes to containers, app startup, or connection to data stores)
  • Have the Agility acceptance criteria been met for this change?

Verification Steps for Reviewers

These are to be checked by a reviewer.

  • Has the branch been pulled in and checked out?
  • Have the BL acceptance criteria been met for this change?
  • Was the CircleCI build successful?
  • Has the code been reviewed from a standards and best practices point of view?

Setup to Run the Code

How to test

  1. Access the Customer app
  2. create a shipment
  3. submit to counselor
  4. login as counselor
  5. search for move that was just created
  6. click Allowances on left side
  7. click on Admin Restricted Weight Location
  8. the weight Restriction box should appear
  9. notice the verbiage change from “Weight allowance” has been changed to “Standard weight allowance”.
  10. add a weight to Weight Restriction and see its saved and viewable on allowances tile
  11. submit the move to TOO(add orders info)
  12. login as TOO search for the move and click approve with shipment(s) selected
  13. on the popup see that the admin restricted weight location value is yes and the weight restriction value is populated
  14. click Approve and send
  15. log in as prime simulator role
  16. in a separate tab go to http://officelocal:3000/swagger-ui/prime.html#/moveTaskOrder/getMoveTaskOrder
  17. review the response in the entitlements object to see that the weight restriction weight is included

Frontend

  • There are no aXe warnings for UI.
  • This works in Supported Browsers and their phone views (Chrome, Firefox, Edge).
  • There are no new console errors in the browser devtools.
  • There are no new console errors in the test output.
  • If this PR adds a new component to Storybook, it ensures the component is fully responsive, OR if it is intentionally not, a wrapping div using the officeApp class or custom min-width styling is used to hide any states the would not be visible to the user.
  • This change meets the standards for Section 508 compliance.

Backend

Database

Any new migrations/schema changes:

  • Follows our guidelines for Zero-Downtime Deploys.
  • Have been communicated to #g-database.
  • Secure migrations have been tested following the instructions in our docs.

Screenshots

image image image

@deandreJones deandreJones added Mountain Movers Movin' Mountains 1 Sprint at a time INTEGRATION Slated for Integration Testing labels Jan 10, 2025
@deandreJones deandreJones marked this pull request as ready for review January 10, 2025 17:49
@deandreJones deandreJones requested review from a team as code owners January 10, 2025 17:49
Copy link
Contributor

@danieljordan-caci danieljordan-caci left a comment

Choose a reason for hiding this comment

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

Couple bugs:

  1. When I uncheck the admin restricted weight location box after putting in a value, it still saves that value on form submission. See video:
    https://github.com/user-attachments/assets/16a2039e-4aff-4d5a-a74e-264924d8e1c5

  2. I can put in a negative value and it saves:
    Screenshot 2025-01-13 at 4 26 10 PM

  3. Can you swip swap some boxes around so all of the checkboxes are all in order? Just requires switching the placement of the standard weight allowance box:
    Screenshot 2025-01-13 at 4 28 17 PM

@deandreJones
Copy link
Contributor Author

Couple bugs:

  1. When I uncheck the admin restricted weight location box after putting in a value, it still saves that value on form submission. See video:
    https://github.com/user-attachments/assets/16a2039e-4aff-4d5a-a74e-264924d8e1c5
  2. I can put in a negative value and it saves:
    Screenshot 2025-01-13 at 4 26 10 PM
  3. Can you swip swap some boxes around so all of the checkboxes are all in order? Just requires switching the placement of the standard weight allowance box:
    Screenshot 2025-01-13 at 4 28 17 PM

what ... what order you thinking? not sure what you mean

@danieljordan-caci
Copy link
Contributor

Couple bugs:

  1. When I uncheck the admin restricted weight location box after putting in a value, it still saves that value on form submission. See video:
    https://github.com/user-attachments/assets/16a2039e-4aff-4d5a-a74e-264924d8e1c5
  2. I can put in a negative value and it saves:
    Screenshot 2025-01-13 at 4 26 10 PM
  3. Can you swip swap some boxes around so all of the checkboxes are all in order? Just requires switching the placement of the standard weight allowance box:
    Screenshot 2025-01-13 at 4 28 17 PM

what ... what order you thinking? not sure what you mean

check the screenshot - I got it arranged how I'd like it

@deandreJones
Copy link
Contributor Author

Couple bugs:

  1. When I uncheck the admin restricted weight location box after putting in a value, it still saves that value on form submission. See video:
    https://github.com/user-attachments/assets/16a2039e-4aff-4d5a-a74e-264924d8e1c5
  2. I can put in a negative value and it saves:
    Screenshot 2025-01-13 at 4 26 10 PM
  3. Can you swip swap some boxes around so all of the checkboxes are all in order? Just requires switching the placement of the standard weight allowance box:
    Screenshot 2025-01-13 at 4 28 17 PM

what ... what order you thinking? not sure what you mean

check the screenshot - I got it arranged how I'd like it

oh- putting the standard weight allowance above all the boxes

@TevinAdams
Copy link
Contributor

Test Case Passed without edge cases:
Screenshot 2025-01-14 at 11 30 27 AM
Screenshot 2025-01-14 at 11 27 33 AM
Screenshot 2025-01-14 at 11 23 17 AM
Screenshot 2025-01-14 at 11 22 06 AM

Copy link
Contributor

@danieljordan-caci danieljordan-caci left a comment

Choose a reason for hiding this comment

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

Getting an error when trying to create a move as a SC:

ERROR   ghcapi/orders.go:276    Data received from requester is bad: BAD_DATA: Error saving entitlement       {"git_branch": "B-21934-INT", "git_commit": "36ed644a365fe4497cf354c22d1bdc3381862220", "host": "officelocal:3000", "milmove_trace_id": "39076976-fcc0-429e-8bff-ea3b02c55279", "session_id": "dcktUPQ_9Bf5YC1vl0Cfnj-PoRilHVkB0ugj-y_57iA"}
github.com/transcom/mymove/pkg/handlers/ghcapi.(*CreateOrderHandler).Handle.CreateOrderHandler.Handle.func1
        /Users/daniel.jordan_cn/mymove/pkg/handlers/ghcapi/orders.go:276
github.com/transcom/mymove/pkg/handlers.(*Config).AuditableAppContextFromRequestWithErrors.func1
        /Users/daniel.jordan_cn/mymove/pkg/handlers/config.go:152
github.com/transcom/mymove/pkg/appcontext.(*appContext).NewTransaction.func1
        /Users/daniel.jordan_cn/mymove/pkg/appcontext/context.go:67

Ran make db_dev_fresh prior to this as well

@@ -31,6 +31,8 @@ type Entitlement struct {
OrganizationalClothingAndIndividualEquipment bool `db:"organizational_clothing_and_individual_equipment"`
ProGearWeight int `db:"pro_gear_weight"`
ProGearWeightSpouse int `db:"pro_gear_weight_spouse"`
AdminRestrictedWeightLocation *bool `db:"admin_restricted_weight_location"`
WeightRestriction *int `db:"weight_restriction"`
Copy link
Contributor

Choose a reason for hiding this comment

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

Looking at your migrations:

+ ALTER TABLE entitlements
ALTER COLUMN admin_restricted weight_location TYPE boolean USING (COALESCE(admin_restricted weight_ location, false)),
ALTER COLUMN admin_restricted weight_ location SET DEFAULT false,
ALTER COLUMN admin_ restricted weight_ location SET NOT NULL

AdminRestrictedWeightLocation is NOT NULL so it shouldn't be a pointer
WeightRestriction can be NULL so it needs to be a pointer

Copy link
Contributor

@cameroncaci cameroncaci left a comment

Choose a reason for hiding this comment

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

Requesting feedback - this ticket didn't have an upstream set properly (Which doesn't break too much thankfully), and the upstream had a change to the db columns for weight restrictions. Switching from entitlements having a bool column of if weight restricted being true is the biggest change from the upstream - the weight restrictor is minimal code changes.

The frontend would need to be modified to not track/send payloads of this bool and instead be under the logic of if weight restricted amount is present (Not NULL), then weight restriction is true and then show the conditional fields.

Also since the migrations aren't deployed yet, suggesting to merge in the upstream migrations to shorten it down to a single migration file

Comment on lines +1 to +4
ALTER TABLE entitlements
ALTER COLUMN admin_restricted_weight_location TYPE boolean USING (COALESCE(admin_restricted_weight_location, false)),
ALTER COLUMN admin_restricted_weight_location SET DEFAULT false,
ALTER COLUMN admin_restricted_weight_location SET NOT NULL;
Copy link
Contributor

Choose a reason for hiding this comment

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

Hey there, so this ticket was missing an upstream (Minimal impact), but in the db it was decided that the boolean value is not needed if we have a not null weight_restriction amount

See #14525 (comment)

Comment on lines +1 to +2
ALTER TABLE entitlements
ADD COLUMN IF NOT EXISTS admin_restricted_weight_location BOOLEAN;
Copy link
Contributor

Choose a reason for hiding this comment

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

Since this is the bool, ref'ing the other file at migrations/app/schema/20250106190758_admin_weight_restriction_convert_bool.up.sql with #14525 (comment)

Comment on lines +63 to +64
AdminRestrictedWeightLocation: setBoolPtr(cEntitlement.AdminRestrictedWeightLocation, false),
WeightRestriction: &weightRestriction,
Copy link
Contributor

Choose a reason for hiding this comment

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

If weight restriction doesn't exist, this would probably be better off left as nil instead of set to 0

Comment on lines +260 to +262
TotalWeight: totalWeight,
WeightRestriction: int64(*entitlement.WeightRestriction),
ETag: etag.GenerateEtag(entitlement.UpdatedAt),
Copy link
Contributor

Choose a reason for hiding this comment

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

If switching to nil, this weight restriction returns empty not nil

Copy link
Contributor

Choose a reason for hiding this comment

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

Once the swagger gets updated I'm sure the IDE intellisense will point out these instances for faster bread crumbing

Comment on lines +467 to +468
weightRestriction := int(payload.WeightRestriction)
order.Entitlement.WeightRestriction = &weightRestriction
Copy link
Contributor

Choose a reason for hiding this comment

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

Thoughts on importing the weight restrictor service for use here?

func (wr *weightRestrictor) ApplyWeightRestrictionToEntitlement(appCtx appcontext.AppContext, entitlement models.Entitlement, weightRestriction int, eTag string) (*models.Entitlement, error) {

@deandreJones
Copy link
Contributor Author

closing due to newly found upstream

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
INTEGRATION Slated for Integration Testing Mountain Movers Movin' Mountains 1 Sprint at a time
Development

Successfully merging this pull request may close these issues.

4 participants