-
Notifications
You must be signed in to change notification settings - Fork 35
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
B 21934 int #14553
Conversation
remove dup- from merge conflict
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couple bugs:
-
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 -
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:
migrations/app/schema/20250107184554_add_weight_restriction.up.sql
Outdated
Show resolved
Hide resolved
src/components/Office/AllowancesDetailForm/AllowancesDetailForm.jsx
Outdated
Show resolved
Hide resolved
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 |
There was a problem hiding this 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"` |
There was a problem hiding this comment.
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
There was a problem hiding this 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
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; |
There was a problem hiding this comment.
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)
ALTER TABLE entitlements | ||
ADD COLUMN IF NOT EXISTS admin_restricted_weight_location BOOLEAN; |
There was a problem hiding this comment.
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)
AdminRestrictedWeightLocation: setBoolPtr(cEntitlement.AdminRestrictedWeightLocation, false), | ||
WeightRestriction: &weightRestriction, |
There was a problem hiding this comment.
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
TotalWeight: totalWeight, | ||
WeightRestriction: int64(*entitlement.WeightRestriction), | ||
ETag: etag.GenerateEtag(entitlement.UpdatedAt), |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
weightRestriction := int(payload.WeightRestriction) | ||
order.Entitlement.WeightRestriction = &weightRestriction |
There was a problem hiding this comment.
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) { |
closing due to newly found upstream |
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.
Verification Steps for Reviewers
These are to be checked by a reviewer.
Setup to Run the Code
How to test
Frontend
officeApp
class or custommin-width
styling is used to hide any states the would not be visible to the user.Backend
Database
Any new migrations/schema changes:
Screenshots