From a7757af972ceb12cbc181979606af04e6bd156b4 Mon Sep 17 00:00:00 2001 From: Jon Spight Date: Mon, 13 Jan 2025 21:25:52 +0000 Subject: [PATCH] Fixed merge conflicts --- pkg/factory/move_factory.go | 28 ++++----- pkg/factory/shared.go | 8 --- .../payloads/model_to_payload_test.go | 63 +------------------ 3 files changed, 14 insertions(+), 85 deletions(-) diff --git a/pkg/factory/move_factory.go b/pkg/factory/move_factory.go index d147fab8d6b..3f923f95204 100644 --- a/pkg/factory/move_factory.go +++ b/pkg/factory/move_factory.go @@ -35,14 +35,6 @@ func BuildMove(db *pop.Connection, customs []Customization, traits []Trait) mode closeoutOffice = BuildTransportationOffice(db, tempCloseoutOfficeCustoms, nil) } - var counselingOffice models.TransportationOffice - tempCounselingOfficeCustoms := customs - counselingOfficeResult := findValidCustomization(customs, TransportationOffices.CounselingOffice) - if counselingOfficeResult != nil { - tempCounselingOfficeCustoms = convertCustomizationInList(tempCounselingOfficeCustoms, TransportationOffices.CounselingOffice, TransportationOffice) - counselingOffice = BuildTransportationOffice(db, tempCounselingOfficeCustoms, nil) - } - var scAssignedUser models.OfficeUser tempSCAssignedUserCustoms := customs scAssignedUserResult := findValidCustomization(customs, OfficeUsers.SCAssignedUser) @@ -67,6 +59,14 @@ func BuildMove(db *pop.Connection, customs []Customization, traits []Trait) mode tioAssignedUser = BuildOfficeUser(db, tempTIOAssignedUserCustoms, nil) } + var counselingOffice models.TransportationOffice + tempCounselingOfficeCustoms := customs + counselingOfficeResult := findValidCustomization(customs, TransportationOffices.CounselingOffice) + if counselingOfficeResult != nil { + tempCounselingOfficeCustoms = convertCustomizationInList(tempCounselingOfficeCustoms, TransportationOffices.CounselingOffice, TransportationOffice) + counselingOffice = BuildTransportationOffice(db, tempCounselingOfficeCustoms, nil) + } + var defaultReferenceID string var err error if db != nil { @@ -105,18 +105,11 @@ func BuildMove(db *pop.Connection, customs []Customization, traits []Trait) mode move.CloseoutOfficeID = &closeoutOffice.ID } - if counselingOfficeResult != nil { - move.CounselingOffice = &counselingOffice - move.CounselingOfficeID = &counselingOffice.ID - } - - if scAssignedUserResult != nil { move.SCAssignedUser = &scAssignedUser move.SCAssignedID = &scAssignedUser.ID } - if tooAssignedUserResult != nil { move.TOOAssignedUser = &tooAssignedUser move.TOOAssignedID = &tooAssignedUser.ID @@ -127,6 +120,11 @@ func BuildMove(db *pop.Connection, customs []Customization, traits []Trait) mode move.TIOAssignedID = &tioAssignedUser.ID } + if counselingOfficeResult != nil { + move.CounselingOffice = &counselingOffice + move.CounselingOfficeID = &counselingOffice.ID + } + // Overwrite values with those from assertions testdatagen.MergeModels(&move, cMove) diff --git a/pkg/factory/shared.go b/pkg/factory/shared.go index 1c0e38146db..207a8cdb86c 100644 --- a/pkg/factory/shared.go +++ b/pkg/factory/shared.go @@ -273,14 +273,6 @@ var TransportationOffices = transportationOfficeGroup{ CounselingOffice: "CounselingOffice", } -type officeUserGroup struct { - SCAssignedUser CustomType -} - -var OfficeUsers = officeUserGroup{ - SCAssignedUser: "SCAssignedUser", -} - type officeUserGroup struct { SCAssignedUser CustomType TOOAssignedUser CustomType diff --git a/pkg/handlers/ghcapi/internal/payloads/model_to_payload_test.go b/pkg/handlers/ghcapi/internal/payloads/model_to_payload_test.go index 7481b293662..d4e330f09b2 100644 --- a/pkg/handlers/ghcapi/internal/payloads/model_to_payload_test.go +++ b/pkg/handlers/ghcapi/internal/payloads/model_to_payload_test.go @@ -14,7 +14,6 @@ import ( "github.com/transcom/mymove/pkg/models" "github.com/transcom/mymove/pkg/models/roles" "github.com/transcom/mymove/pkg/storage/test" - "github.com/transcom/mymove/pkg/testdatagen" "github.com/transcom/mymove/pkg/unit" ) @@ -805,8 +804,6 @@ func (suite *PayloadsSuite) TestSearchMoves() { appCtx := suite.AppContextForTest() marines := models.AffiliationMARINES - spaceForce := models.AffiliationSPACEFORCE - army := models.AffiliationARMY moveUSMC := factory.BuildMove(suite.DB(), []factory.Customization{ { Model: models.ServiceMember{ @@ -814,73 +811,15 @@ func (suite *PayloadsSuite) TestSearchMoves() { }, }, }, nil) - moveSF := factory.BuildMove(suite.DB(), []factory.Customization{ - { - Model: models.ServiceMember{ - Affiliation: &spaceForce, - }, - }, - }, nil) - moveA := factory.BuildMove(suite.DB(), []factory.Customization{ - { - Model: models.ServiceMember{ - Affiliation: &army, - }, - }, - }, nil) - moveUSMC.Status = models.MoveStatusNeedsServiceCounseling - scheduledPickupDate := time.Date(testdatagen.GHCTestYear, time.September, 20, 0, 0, 0, 0, time.UTC) - scheduledDeliveryDate := time.Date(testdatagen.GHCTestYear, time.September, 20, 0, 0, 0, 0, time.UTC) - sitAllowance := int(90) - gbloc := "LKNQ" - storageFacility := factory.BuildStorageFacility(suite.DB(), nil, nil) - mtoShipment := factory.BuildMTOShipment(suite.DB(), []factory.Customization{ - { - Model: moveSF, - LinkOnly: true, - }, - { - Model: models.MTOShipment{ - Status: models.MTOShipmentStatusApproved, - ShipmentType: models.MTOShipmentTypeHHGIntoNTSDom, - CounselorRemarks: handlers.FmtString("counselor remark"), - SITDaysAllowance: &sitAllowance, - ScheduledPickupDate: &scheduledPickupDate, - ScheduledDeliveryDate: &scheduledDeliveryDate, - }, - }, - { - Model: storageFacility, - LinkOnly: true, - }, - }, nil) - - moveSF.MTOShipments = append(moveSF.MTOShipments, mtoShipment) - moveSF.ShipmentGBLOC = append(moveSF.ShipmentGBLOC, models.MoveToGBLOC{GBLOC: &gbloc}) moves := models.Moves{moveUSMC} - moveSpaceForce := models.Moves{moveSF} - moveArmy := models.Moves{moveA} + suite.Run("Success - Returns a ghcmessages Upload payload from Upload Struct Marine move with no shipments", func() { payload := SearchMoves(appCtx, moves) suite.IsType(payload, &ghcmessages.SearchMoves{}) suite.NotNil(payload) }) - suite.Run("Success - Returns a ghcmessages Upload payload from Upload Struct Non-Marine move, a shipment, and delivery/pickup time. ", func() { - payload := SearchMoves(appCtx, moveSpaceForce) - suite.IsType(payload, &ghcmessages.SearchMoves{}) - suite.NotNil(payload) - suite.NotNil(mtoShipment) - - suite.NotNil(moveA) - }) - suite.Run("Success - Returns a ghcmessages Upload payload from Upload Struct Army move, with no shipments. ", func() { - payload := SearchMoves(appCtx, moveArmy) - suite.IsType(payload, &ghcmessages.SearchMoves{}) - suite.NotNil(payload) - - }) } func (suite *PayloadsSuite) TestMarketCode() {