Skip to content

Commit

Permalink
Fixed merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
JonSpight committed Jan 13, 2025
1 parent bedba6f commit a7757af
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 85 deletions.
28 changes: 13 additions & 15 deletions pkg/factory/move_factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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 {
Expand Down Expand Up @@ -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
Expand All @@ -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)

Expand Down
8 changes: 0 additions & 8 deletions pkg/factory/shared.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
63 changes: 1 addition & 62 deletions pkg/handlers/ghcapi/internal/payloads/model_to_payload_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down Expand Up @@ -805,82 +804,22 @@ 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{
Affiliation: &marines,
},
},
}, 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() {
Expand Down

0 comments on commit a7757af

Please sign in to comment.