Skip to content

Commit

Permalink
added too weight allowance updater
Browse files Browse the repository at this point in the history
  • Loading branch information
cameroncaci committed Jan 29, 2024
1 parent 05c2bb0 commit bb7a2c6
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions pkg/services/order/order_updater.go
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,16 @@ func allowanceFromTOOPayload(existingOrder models.Order, payload ghcmessages.Upd
order.Grade = &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 && *payload.DependentsAuthorized {
// Only utilize dependent weight authorized if dependents are both present and authorized
weight = weightAllotment.TotalWeightSelfPlusDependents
}
order.Entitlement.DBAuthorizedWeight = &weight

if payload.OrganizationalClothingAndIndividualEquipment != nil {
order.Entitlement.OrganizationalClothingAndIndividualEquipment = *payload.OrganizationalClothingAndIndividualEquipment
}
Expand Down

0 comments on commit bb7a2c6

Please sign in to comment.