Skip to content

Commit

Permalink
Merge branch 'main' into B-22110-PerformanceOptimization-Gitlab-NFP
Browse files Browse the repository at this point in the history
  • Loading branch information
josiahzimmerman-caci authored Jan 14, 2025
2 parents d204e63 + c45a1d6 commit bdaca14
Show file tree
Hide file tree
Showing 91 changed files with 3,545 additions and 217 deletions.
2 changes: 2 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -900,6 +900,7 @@ commands:
export FEATURE_FLAG_UNACCOMPANIED_BAGGAGE=false
export FEATURE_FLAG_ENABLE_ALASKA=false
export FEATURE_FLAG_ENABLE_HAWAII=false
export FEATURE_FLAG_BULK_ASSIGNMENT=false
# disable for speed, playwright tests can fail otherwise
export DB_DEBUG=false
Expand Down Expand Up @@ -943,6 +944,7 @@ commands:
FEATURE_FLAG_QUEUE_MANAGEMENT: 'false'
FEATURE_FLAG_UNACCOMPANIED_BAGGAGE: 'false'
FEATURE_FLAG_ENABLE_ALASKA: 'false'
FEATURE_FLAG_BULK_ASSIGNMENT: 'false'
command: |
SHARD=$((${CIRCLE_NODE_INDEX}+1))
PLAYWRIGHT_JUNIT_OUTPUT_NAME=playwright-results.xml \
Expand Down
3 changes: 3 additions & 0 deletions .envrc
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,9 @@ export FEATURE_FLAG_BOAT=true
export FEATURE_FLAG_MOBILE_HOME=true
export FEATURE_FLAG_UNACCOMPANIED_BAGGAGE=false

# Feature flag to allow Bulk Assigment options to be displayed
export FEATURE_FLAG_BULK_ASSIGNMENT=true

# Feature flag to allow AK to be entered as a state
export FEATURE_FLAG_ENABLE_ALASKA=true

Expand Down
3 changes: 2 additions & 1 deletion config/env/demo.app-client-tls.env
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,5 @@ FEATURE_FLAG_THIRD_ADDRESS_AVAILABLE=false
FEATURE_FLAG_QUEUE_MANAGEMENT=false
FEATURE_FLAG_DODID_UNIQUE=false
FEATURE_FLAG_ENABLE_ALASKA=false
FEATURE_FLAG_ENABLE_HAWAII=false
FEATURE_FLAG_ENABLE_HAWAII=false
FEATURE_FLAG_BULK_ASSIGNMENT=false
3 changes: 2 additions & 1 deletion config/env/demo.app.env
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,5 @@ FEATURE_FLAG_THIRD_ADDRESS_AVAILABLE=false
FEATURE_FLAG_QUEUE_MANAGEMENT=false
FEATURE_FLAG_DODID_UNIQUE=false
FEATURE_FLAG_ENABLE_ALASKA=false
FEATURE_FLAG_ENABLE_HAWAII=false
FEATURE_FLAG_ENABLE_HAWAII=false
FEATURE_FLAG_BULK_ASSIGNMENT=false
3 changes: 2 additions & 1 deletion config/env/exp.app-client-tls.env
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,5 @@ FEATURE_FLAG_THIRD_ADDRESS_AVAILABLE=false
FEATURE_FLAG_QUEUE_MANAGEMENT=false
FEATURE_FLAG_DODID_UNIQUE=false
FEATURE_FLAG_ENABLE_ALASKA=false
FEATURE_FLAG_ENABLE_HAWAII=false
FEATURE_FLAG_ENABLE_HAWAII=false
FEATURE_FLAG_BULK_ASSIGNMENT=false
3 changes: 2 additions & 1 deletion config/env/exp.app.env
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,5 @@ FEATURE_FLAG_THIRD_ADDRESS_AVAILABLE=false
FEATURE_FLAG_QUEUE_MANAGEMENT=false
FEATURE_FLAG_DODID_UNIQUE=false
FEATURE_FLAG_ENABLE_ALASKA=false
FEATURE_FLAG_ENABLE_HAWAII=false
FEATURE_FLAG_ENABLE_HAWAII=false
FEATURE_FLAG_BULK_ASSIGNMENT=false
3 changes: 2 additions & 1 deletion config/env/loadtest.app-client-tls.env
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,5 @@ FEATURE_FLAG_THIRD_ADDRESS_AVAILABLE=false
FEATURE_FLAG_QUEUE_MANAGEMENT=false
FEATURE_FLAG_DODID_UNIQUE=false
FEATURE_FLAG_ENABLE_ALASKA=false
FEATURE_FLAG_ENABLE_HAWAII=false
FEATURE_FLAG_ENABLE_HAWAII=false
FEATURE_FLAG_BULK_ASSIGNMENT=false
3 changes: 2 additions & 1 deletion config/env/loadtest.app.env
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,5 @@ FEATURE_FLAG_THIRD_ADDRESS_AVAILABLE=false
FEATURE_FLAG_QUEUE_MANAGEMENT=false
FEATURE_FLAG_DODID_UNIQUE=false
FEATURE_FLAG_ENABLE_ALASKA=false
FEATURE_FLAG_ENABLE_HAWAII=false
FEATURE_FLAG_ENABLE_HAWAII=false
FEATURE_FLAG_BULK_ASSIGNMENT=false
3 changes: 2 additions & 1 deletion config/env/prd.app-client-tls.env
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,5 @@ FEATURE_FLAG_THIRD_ADDRESS_AVAILABLE=false
FEATURE_FLAG_QUEUE_MANAGEMENT=false
FEATURE_FLAG_DODID_UNIQUE=false
FEATURE_FLAG_ENABLE_ALASKA=false
FEATURE_FLAG_ENABLE_HAWAII=false
FEATURE_FLAG_ENABLE_HAWAII=false
FEATURE_FLAG_BULK_ASSIGNMENT=false
3 changes: 2 additions & 1 deletion config/env/prd.app.env
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,5 @@ FEATURE_FLAG_THIRD_ADDRESS_AVAILABLE=false
FEATURE_FLAG_QUEUE_MANAGEMENT=false
FEATURE_FLAG_DODID_UNIQUE=false
FEATURE_FLAG_ENABLE_ALASKA=false
FEATURE_FLAG_ENABLE_HAWAII=false
FEATURE_FLAG_ENABLE_HAWAII=false
FEATURE_FLAG_BULK_ASSIGNMENT=false
3 changes: 2 additions & 1 deletion config/env/stg.app-client-tls.env
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,5 @@ FEATURE_FLAG_THIRD_ADDRESS_AVAILABLE=false
FEATURE_FLAG_QUEUE_MANAGEMENT=false
FEATURE_FLAG_DODID_UNIQUE=false
FEATURE_FLAG_ENABLE_ALASKA=false
FEATURE_FLAG_ENABLE_HAWAII=false
FEATURE_FLAG_ENABLE_HAWAII=false
FEATURE_FLAG_BULK_ASSIGNMENT=false
3 changes: 2 additions & 1 deletion config/env/stg.app.env
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,5 @@ FEATURE_FLAG_THIRD_ADDRESS_AVAILABLE=false
FEATURE_FLAG_QUEUE_MANAGEMENT=false
FEATURE_FLAG_DODID_UNIQUE=false
FEATURE_FLAG_ENABLE_ALASKA=false
FEATURE_FLAG_ENABLE_HAWAII=false
FEATURE_FLAG_ENABLE_HAWAII=false
FEATURE_FLAG_BULK_ASSIGNMENT=false
8 changes: 8 additions & 0 deletions config/flipt/storage/development.features.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,14 @@ flags:
- segment:
key: mil-app
value: true
- key: bulk_assignment
name: bulk assignment feature flag
type: BOOLEAN_FLAG_TYPE
enabled: true
rollouts:
- segment:
key: mil-app
value: true
- key: dodid_unique
name: DODID validation feature flag that ensures unique DODIDs
type: BOOLEAN_FLAG_TYPE
Expand Down
54 changes: 54 additions & 0 deletions pkg/factory/move_factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,38 @@ func BuildMove(db *pop.Connection, customs []Customization, traits []Trait) mode
closeoutOffice = BuildTransportationOffice(db, tempCloseoutOfficeCustoms, nil)
}

var scAssignedUser models.OfficeUser
tempSCAssignedUserCustoms := customs
scAssignedUserResult := findValidCustomization(customs, OfficeUsers.SCAssignedUser)
if scAssignedUserResult != nil {
tempSCAssignedUserCustoms = convertCustomizationInList(tempSCAssignedUserCustoms, OfficeUsers.SCAssignedUser, OfficeUser)
scAssignedUser = BuildOfficeUser(db, tempSCAssignedUserCustoms, nil)
}

var tooAssignedUser models.OfficeUser
tempTOOAssignedUserCustoms := customs
tooAssignedUserResult := findValidCustomization(customs, OfficeUsers.TOOAssignedUser)
if tooAssignedUserResult != nil {
tempTOOAssignedUserCustoms = convertCustomizationInList(tempTOOAssignedUserCustoms, OfficeUsers.TOOAssignedUser, OfficeUser)
tooAssignedUser = BuildOfficeUser(db, tempTOOAssignedUserCustoms, nil)
}

var tioAssignedUser models.OfficeUser
tempTIOAssignedUserCustoms := customs
tioAssignedUserResult := findValidCustomization(customs, OfficeUsers.TIOAssignedUser)
if tioAssignedUserResult != nil {
tempTIOAssignedUserCustoms = convertCustomizationInList(tempTIOAssignedUserCustoms, OfficeUsers.TIOAssignedUser, OfficeUser)
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 @@ -73,6 +105,26 @@ func BuildMove(db *pop.Connection, customs []Customization, traits []Trait) mode
move.CloseoutOfficeID = &closeoutOffice.ID
}

if tooAssignedUserResult != nil {
move.TOOAssignedUser = &tooAssignedUser
move.TOOAssignedID = &tooAssignedUser.ID
}

if tioAssignedUserResult != nil {
move.TIOAssignedUser = &tioAssignedUser
move.TIOAssignedID = &tioAssignedUser.ID
}

if counselingOfficeResult != nil {
move.CounselingOffice = &counselingOffice
move.CounselingOfficeID = &counselingOffice.ID
}

if scAssignedUserResult != nil {
move.SCAssignedUser = &scAssignedUser
move.SCAssignedID = &scAssignedUser.ID
}

// Overwrite values with those from assertions
testdatagen.MergeModels(&move, cMove)

Expand Down Expand Up @@ -165,6 +217,8 @@ func BuildMoveWithShipment(db *pop.Connection, customs []Customization, traits [
return move
}
func BuildMoveWithPPMShipment(db *pop.Connection, customs []Customization, traits []Trait) models.Move {
// Please note this function runs BuildMove 3 times
// Once here, once in buildMTOShipmentWithBuildType, and once in BuildPPMShipment
move := BuildMove(db, customs, traits)

mtoShipment := buildMTOShipmentWithBuildType(db, customs, traits, mtoShipmentPPM)
Expand Down
71 changes: 71 additions & 0 deletions pkg/factory/move_factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"time"

"github.com/transcom/mymove/pkg/models"
"github.com/transcom/mymove/pkg/models/roles"
)

func (suite *FactorySuite) TestBuildMove() {
Expand Down Expand Up @@ -258,6 +259,23 @@ func (suite *FactorySuite) TestBuildMove() {
suite.NotNil(move.AvailableToPrimeAt)
suite.NotNil(move.ApprovedAt)
})
suite.Run("Successful creation of a move with an assigned SC", func() {
officeUser := BuildOfficeUserWithRoles(suite.DB(), nil, []roles.RoleType{roles.RoleTypeServicesCounselor})

move := BuildMoveWithShipment(suite.DB(), []Customization{
{
Model: models.Move{
Status: models.MoveStatusNeedsServiceCounseling,
},
},
{
Model: officeUser,
LinkOnly: true,
Type: &OfficeUsers.SCAssignedUser,
},
}, nil)
suite.Equal(officeUser.ID, *move.SCAssignedID)
})
suite.Run("Successful creation of move with shipment", func() {
// Under test: BuildMoveWithShipment
// Set up: Create a move using BuildMoveWithShipment
Expand All @@ -267,6 +285,59 @@ func (suite *FactorySuite) TestBuildMove() {
suite.NotEmpty(move.MTOShipments)
suite.Equal(models.MTOShipmentStatusSubmitted, move.MTOShipments[0].Status)
})
suite.Run("Successful creation of a move with an assigned SC", func() {
officeUser := BuildOfficeUserWithRoles(suite.DB(), nil, []roles.RoleType{roles.RoleTypeServicesCounselor})

move := BuildMoveWithShipment(suite.DB(), []Customization{
{
Model: models.Move{
Status: models.MoveStatusAPPROVED,
},
},
{
Model: officeUser,
LinkOnly: true,
Type: &OfficeUsers.SCAssignedUser,
},
}, nil)
suite.Equal(officeUser.ID, *move.SCAssignedID)
})

suite.Run("Successful creation of a move with an assigned TOO", func() {
officeUser := BuildOfficeUserWithRoles(suite.DB(), nil, []roles.RoleType{roles.RoleTypeTOO})

move := BuildMoveWithShipment(suite.DB(), []Customization{
{
Model: models.Move{
Status: models.MoveStatusAPPROVED,
},
},
{
Model: officeUser,
LinkOnly: true,
Type: &OfficeUsers.TOOAssignedUser,
},
}, nil)
suite.Equal(officeUser.ID, *move.TOOAssignedID)
})

suite.Run("Successful creation of a move with an assigned TIO", func() {
officeUser := BuildOfficeUserWithRoles(suite.DB(), nil, []roles.RoleType{roles.RoleTypeTIO})

move := BuildMoveWithShipment(suite.DB(), []Customization{
{
Model: models.Move{
Status: models.MoveStatusAPPROVED,
},
},
{
Model: officeUser,
LinkOnly: true,
Type: &OfficeUsers.TIOAssignedUser,
},
}, nil)
suite.Equal(officeUser.ID, *move.TIOAssignedID)
})

suite.Run("Successful creation of customized move with shipment", func() {
// Under test: BuildMoveWithShipment
Expand Down
43 changes: 40 additions & 3 deletions pkg/factory/office_user_factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,25 @@ func BuildOfficeUser(db *pop.Connection, customs []Customization, traits []Trait
// Find/create the user model
user := BuildUserAndUsersRoles(db, customs, nil)

// Find/create the TransportationOffice model
transportationOffice := BuildTransportationOffice(db, customs, nil)
var transportationOffice models.TransportationOffice

tempCloseoutOfficeCustoms := customs
closeoutOfficeResult := findValidCustomization(customs, TransportationOffices.CloseoutOffice)
if closeoutOfficeResult != nil {
tempCloseoutOfficeCustoms = convertCustomizationInList(tempCloseoutOfficeCustoms, TransportationOffices.CloseoutOffice, TransportationOffice)
transportationOffice = BuildTransportationOffice(db, tempCloseoutOfficeCustoms, nil)
}

tempCounselingOfficeCustoms := customs
counselingOfficeResult := findValidCustomization(customs, TransportationOffices.CounselingOffice)
if counselingOfficeResult != nil {
tempCounselingOfficeCustoms = convertCustomizationInList(tempCounselingOfficeCustoms, TransportationOffices.CounselingOffice, TransportationOffice)
transportationOffice = BuildTransportationOffice(db, tempCounselingOfficeCustoms, nil)
}

if closeoutOfficeResult == nil && counselingOfficeResult == nil {
transportationOffice = BuildTransportationOffice(db, customs, nil)
}

// create officeuser
officeUser := models.OfficeUser{
Expand All @@ -51,6 +68,7 @@ func BuildOfficeUser(db *pop.Connection, customs []Customization, traits []Trait
TransportationOffice: transportationOffice,
TransportationOfficeID: transportationOffice.ID,
}

// Overwrite values with those from assertions
testdatagen.MergeModels(&officeUser, cOfficeUser)

Expand Down Expand Up @@ -200,7 +218,25 @@ func BuildOfficeUserWithPrivileges(db *pop.Connection, customs []Customization,
user := BuildUserAndUsersRolesAndUsersPrivileges(db, customs, nil)

// Find/create the TransportationOffice model
transportationOffice := BuildTransportationOffice(db, customs, nil)
var transportationOffice models.TransportationOffice

tempCloseoutOfficeCustoms := customs
closeoutOfficeResult := findValidCustomization(customs, TransportationOffices.CloseoutOffice)
if closeoutOfficeResult != nil {
tempCloseoutOfficeCustoms = convertCustomizationInList(tempCloseoutOfficeCustoms, TransportationOffices.CloseoutOffice, TransportationOffice)
transportationOffice = BuildTransportationOffice(db, tempCloseoutOfficeCustoms, nil)
}

tempCounselingOfficeCustoms := customs
counselingOfficeResult := findValidCustomization(customs, TransportationOffices.CounselingOffice)
if counselingOfficeResult != nil {
tempCounselingOfficeCustoms = convertCustomizationInList(tempCounselingOfficeCustoms, TransportationOffices.CounselingOffice, TransportationOffice)
transportationOffice = BuildTransportationOffice(db, tempCounselingOfficeCustoms, nil)
}

if closeoutOfficeResult == nil && counselingOfficeResult == nil {
transportationOffice = BuildTransportationOffice(db, customs, nil)
}

// create officeuser
officeUser := models.OfficeUser{
Expand All @@ -213,6 +249,7 @@ func BuildOfficeUserWithPrivileges(db *pop.Connection, customs []Customization,
TransportationOffice: transportationOffice,
TransportationOfficeID: transportationOffice.ID,
}

// Overwrite values with those from assertions
testdatagen.MergeModels(&officeUser, cOfficeUser)

Expand Down
Loading

0 comments on commit bdaca14

Please sign in to comment.