Skip to content
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

Merged
merged 175 commits into from
Oct 24, 2024
Merged

B 21442 int #13872

merged 175 commits into from
Oct 24, 2024

Conversation

begrohmann
Copy link
Contributor

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.

  • Tested in the Experimental environment (for changes to containers, app startup, or connection to data stores)
  • Have the Agility acceptance criteria been met for this change?

Verification Steps for Reviewers

These are to be checked by a reviewer.

  • Has the branch been pulled in and checked out?
  • Have the BL acceptance criteria been met for this change?
  • Was the CircleCI build successful?
  • Has the code been reviewed from a standards and best practices point of view?

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:

  • Follows our guidelines for Zero-Downtime Deploys.
  • Have been communicated to #g-database.
  • Secure migrations have been tested following the instructions in our docs.

Screenshots

}

func (ReInternationalTransitTime) TableName() string {
return "re_international_transit_times"
Copy link
Contributor

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

Copy link
Contributor

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.

Comment on lines 308 to 332
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
}
Copy link
Contributor

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

Copy link
Contributor

@r-mettler r-mettler Oct 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at the history in INT, looks like this commit added it but in the next commit its not there.

Copy link
Contributor

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.

Copy link
Contributor

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

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed

Comment on lines 81 to 104
// 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
}
}

Copy link
Contributor

@danieljordan-caci danieljordan-caci Oct 23, 2024

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

Copy link
Contributor

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.

Copy link
Contributor

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
Copy link
Contributor

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

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks git lol

Copy link
Contributor

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() {
Copy link
Contributor

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.

Copy link
Contributor

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.

Copy link
Contributor

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

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated the description

}

func (InternationalTransitTime) TableName() string {
return "re_international_transit_times"
Copy link
Contributor

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

Copy link
Contributor

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

@r-mettler r-mettler dismissed cameroncaci’s stale review October 24, 2024 13:58

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.

@r-mettler r-mettler merged commit 7456470 into integrationTesting Oct 24, 2024
28 of 29 checks passed
@r-mettler r-mettler deleted the B-21442-INT branch October 24, 2024 15:11
@r-mettler r-mettler mentioned this pull request Oct 24, 2024
9 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
database INTEGRATION Slated for Integration Testing
Development

Successfully merging this pull request may close these issues.

8 participants