Skip to content

Commit

Permalink
Merge pull request #14004 from transcom/MAIN-B-21429-and-B-21431
Browse files Browse the repository at this point in the history
MAIN B-21429 and B-21431
  • Loading branch information
deandreJones authored Oct 25, 2024
2 parents d2b1660 + 9b681c9 commit 837e42f
Show file tree
Hide file tree
Showing 52 changed files with 1,061 additions and 28 deletions.
1 change: 1 addition & 0 deletions migrations/app/migrations_manifest.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1018,4 +1018,5 @@
20241007184230_insertReOconusRateAreas.up.sql
20241007184259_insertReIntlTransTime.up.sql
20241007224427_update_addresses_us_post_region_cities_id.up.sql
20241008212243_populate_market_code_on_shipments_table.up.sql
20241009210749_create_view_v_locations.up.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
-- Set temp timeout due to potentially large modification
-- Time is 5 minutes in milliseconds
SET statement_timeout = 300000;
SET lock_timeout = 300000;
SET idle_in_transaction_session_timeout = 300000;

-- Populate the new market_code column for shipments
-- since we do not support OCONUS moves yet, these should all be "d"
UPDATE mto_shipments
SET market_code = 'd'
WHERE market_code IS NULL;

-- Add a NOT NULL constraint to the market_code column after we populate with data
ALTER TABLE mto_shipments
ALTER COLUMN market_code SET NOT NULL;

-- fixing typo from previous migration
COMMENT ON COLUMN mto_shipments.market_code IS 'Market code indicator for the shipment. i for international and d for domestic.';
7 changes: 7 additions & 0 deletions pkg/factory/mto_shipment_factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ func buildMTOShipmentWithBuildType(db *pop.Connection, customs []Customization,
// defaults change depending on mtoshipment build type
defaultShipmentType := models.MTOShipmentTypeHHG
defaultStatus := models.MTOShipmentStatusSubmitted
defaultMarketCode := models.MarketCodeDomestic
setupPickupAndDelivery := true
hasStorageFacilityCustom := findValidCustomization(customs, StorageFacility) != nil
buildStorageFacility :=
Expand Down Expand Up @@ -75,6 +76,7 @@ func buildMTOShipmentWithBuildType(db *pop.Connection, customs []Customization,
MoveTaskOrderID: move.ID,
ShipmentType: defaultShipmentType,
Status: defaultStatus,
MarketCode: defaultMarketCode,
}

if cMtoShipment.Status == models.MTOShipmentStatusApproved {
Expand Down Expand Up @@ -377,6 +379,11 @@ func BuildMTOShipmentMinimal(db *pop.Connection, customs []Customization, traits
}
}

mtoShipment.MarketCode = models.MarketCodeDomestic
if db != nil {
mustSave(db, &mtoShipment)
}

return mtoShipment
}

Expand Down
18 changes: 18 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.

52 changes: 52 additions & 0 deletions pkg/gen/ghcmessages/m_t_o_shipment.go

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

18 changes: 18 additions & 0 deletions pkg/gen/internalapi/embedded_spec.go

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

52 changes: 52 additions & 0 deletions pkg/gen/internalmessages/m_t_o_shipment.go

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

18 changes: 18 additions & 0 deletions pkg/gen/primeapi/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/primemessages/m_t_o_shipment_without_service_items.go

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

Loading

0 comments on commit 837e42f

Please sign in to comment.