-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
B 21442 int #13872
B 21442 int #13872
Conversation
…nscom/mymove into B-21442
…ate re_cities insert
} | ||
|
||
func (ReInternationalTransitTime) TableName() string { | ||
return "re_international_transit_times" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This table name is incorrect - the migration is re_intl_transit_times
Please change the file & struct name as well to match
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed filename to be plural and removed the Re from the struct name.
pkg/models/service_member.go
Outdated
if serviceMember.BackupMailingAddress.Country != nil { | ||
country := serviceMember.BackupMailingAddress.Country | ||
if country.Country != "US" || country.Country == "US" && serviceMember.BackupMailingAddress.State == "AK" || country.Country == "US" && serviceMember.BackupMailingAddress.State == "HI" { | ||
boolTrueVal := true | ||
serviceMember.BackupMailingAddress.IsOconus = &boolTrueVal | ||
} else { | ||
boolFalseVal := false | ||
serviceMember.BackupMailingAddress.IsOconus = &boolFalseVal | ||
} | ||
} else if serviceMember.BackupMailingAddress.CountryId != nil { | ||
country, err := FetchCountryByID(appCtx.DB(), *serviceMember.BackupMailingAddress.CountryId) | ||
if err != nil { | ||
return err | ||
} | ||
if country.Country != "US" || country.Country == "US" && serviceMember.BackupMailingAddress.State == "AK" || country.Country == "US" && serviceMember.BackupMailingAddress.State == "HI" { | ||
boolTrueVal := true | ||
serviceMember.BackupMailingAddress.IsOconus = &boolTrueVal | ||
} else { | ||
boolFalseVal := false | ||
serviceMember.BackupMailingAddress.IsOconus = &boolFalseVal | ||
} | ||
} else { | ||
boolFalseVal := false | ||
serviceMember.BackupMailingAddress.IsOconus = &boolFalseVal | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wondering why this is not in the code... It was def merged in this PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@danieljordan-caci Can you verify this is in the correct spot in the code since git placed it here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually this should be removed. The same check gets done at the line above:
// Evaluate address and populate addresses isOconus value
isOconus, err := IsAddressOconus(appCtx.DB(), *serviceMember.BackupMailingAddress)
if err != nil {
responseError = err
return err
}
serviceMember.BackupMailingAddress.IsOconus = &isOconus
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed
// use the data we have first, if it's not nil | ||
if mergedAddress.State != originalAddress.State && mergedAddress.Country != nil { | ||
country := mergedAddress.Country | ||
if country.Country != "US" || country.Country == "US" && mergedAddress.State == "AK" || country.Country == "US" && mergedAddress.State == "HI" { | ||
boolTrueVal := true | ||
mergedAddress.IsOconus = &boolTrueVal | ||
} else { | ||
boolFalseVal := false | ||
mergedAddress.IsOconus = &boolFalseVal | ||
} | ||
} else if mergedAddress.State != originalAddress.State && mergedAddress.CountryId != nil { | ||
country, err := models.FetchCountryByID(appCtx.DB(), *mergedAddress.CountryId) | ||
if err != nil { | ||
return nil, err | ||
} | ||
if country.Country != "US" || country.Country == "US" && mergedAddress.State == "AK" || country.Country == "US" && mergedAddress.State == "HI" { | ||
boolTrueVal := true | ||
mergedAddress.IsOconus = &boolTrueVal | ||
} else { | ||
boolFalseVal := false | ||
mergedAddress.IsOconus = &boolFalseVal | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This shouldn't be in here - please remove. The line above it does the exact same check.
// Evaluate address and populate addresses isOconus value
isOconus, err := models.IsAddressOconus(appCtx.DB(), mergedAddress)
if err != nil {
return nil, err
}
mergedAddress.IsOconus = &isOconus
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was pulled in from your commit
😄
Glad your reviewing these. Updating it now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed
@@ -57,6 +57,7 @@ func (f *addressCreator) CreateAddress(appCtx appcontext.AppContext, address *mo | |||
} | |||
transformedAddress.Country = &country | |||
transformedAddress.CountryId = &country.ID | |||
transformedAddress.Country = &country |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this line - it's a duplicate
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks git lol
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed the duplicate, this was from a git merge so its only in the INT branch and not on the main.
@@ -71,6 +72,21 @@ func (suite *AddressSuite) TestAddressCreator() { | |||
suite.Equal("- the country GB is not supported at this time - only US is allowed", err.Error()) | |||
}) | |||
|
|||
suite.Run("Transforms Country to nil when no country name is specified", func() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The title of this test is incorrect - you're testing that if a nil country is provided and checking that an error is returned. Please change the title to be more descriptive to what's being tested.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These weren't changes that we made, assuming they came from your branch since it states Country. I'll go change it here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah some funky stuff goin' on
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated the description
MAIN B-21073
} | ||
|
||
func (InternationalTransitTime) TableName() string { | ||
return "re_international_transit_times" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This table name is still wrong. It's re_intl_transit_times
in your migration
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It wasn't at one point 😄 . I fixed it, good catch
Had discussions on validators and since we made the models read only validators aren't needed. The only test to be added just returns a string and isn't covered in the test coverage. We will add more tests as we start transferring addresses model over to using these new tables.
B-21442
Summary
The purpose of this BL is to add AK locations to us_post_region_cities table. In doing so, we also created several parent tables with city, state and zip data with associated ids to us_post_region_cities and addresses tables:
re_states
re_us_post_regions
re_cities
We created the following tables for OCONUS rate area associations and transit times:
re_oconus_rate_areas
re_intl_transit_times
We created a new view v_locations to query by city, state, zip, country and/or country and see all associated ids.
Verification Steps for the Author
These are to be checked by the author.
Verification Steps for Reviewers
These are to be checked by a reviewer.
How to test
Database
Open the database.
Check that the following tables exist with data:
re_states
re_cities
re_us_post_regions
re_oconus_rate_areas
re_intl_transit_times
Check that us_post_region_cities table has the following new columns added and populated with data:
us_post_regions_id
cities_id
Check that addresses table has the us_post_region_cities_id column added. We have populated most of the associated data but there is some fallout where there is no county, the city does not match what is in re_cities or the combination of the data does not match up with us_post_region_cities. We will handle this in an upcoming BL when FK constraints are added. Data cleanup will be case by case.
Check that the v_locations view was created and you can query data.
Any new migrations/schema changes:
Screenshots