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 20526 int - Backend | Sort Customer dropdown of Counseling Offices #13891

Merged
merged 51 commits into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
90ca35f
B-21000-main merge
JonSpight Oct 10, 2024
5fd359e
Updated counseling offices Query (ordered by distance)
JonSpight Oct 11, 2024
a926940
Merge branch 'main' of https://github.com/transcom/mymove into B-2052…
JonSpight Oct 11, 2024
610ddb3
B-20526-main
JonSpight Oct 11, 2024
c5ffb88
PR Fixes
JonSpight Oct 14, 2024
ac14bb7
Merge branch 'B-20526-main' into B-20526-int
JonSpight Oct 14, 2024
98cdc3d
Fixed files
JonSpight Oct 14, 2024
4ae3c5e
int branch merge
JonSpight Oct 14, 2024
bbb9856
Draft update
JonSpight Oct 14, 2024
a4ce85c
Draft update
JonSpight Oct 14, 2024
e512858
Merge remote-tracking branch 'origin' into B-20526-main
JonSpight Oct 16, 2024
46ca065
SQL query unfinished
JonSpight Oct 16, 2024
77656b5
Merge remote-tracking branch 'origin' into B-20526-main
JonSpight Oct 16, 2024
eb93b36
fixed files
JonSpight Oct 16, 2024
a2fd241
Updated sql query
JonSpight Oct 17, 2024
c002253
Merge remote-tracking branch 'origin' into B-20526-main
JonSpight Oct 17, 2024
932b6c7
Merge branch 'B-20526-main' into B-20526-int
JonSpight Oct 17, 2024
c031105
fixed files
JonSpight Oct 17, 2024
6b01a7a
fixed files
JonSpight Oct 17, 2024
c4d19df
Merge branch 'integrationTesting' into B-20526-int
JonSpight Oct 18, 2024
a582388
test cases
JonSpight Oct 18, 2024
0faf9fe
Merge branch 'B-20526-main' into B-20526-int
JonSpight Oct 18, 2024
ccd8d94
Merge branch 'integrationTesting' into B-20526-int
JonSpight Oct 18, 2024
52be711
test cases
JonSpight Oct 18, 2024
29afdbe
merge
JonSpight Oct 18, 2024
9e2c3fc
test changes
JonSpight Oct 18, 2024
9e51b20
test
JonSpight Oct 18, 2024
e7dfe65
testFetcher
JonSpight Oct 18, 2024
be3b92c
Merge branch 'integrationTesting' into B-20526-int
JonSpight Oct 21, 2024
7fd2e7b
TestOfficeFetcher
JonSpight Oct 21, 2024
a80380b
test fetcher zip update
JonSpight Oct 21, 2024
b9b8144
offices length
JonSpight Oct 21, 2024
43131ea
test fetched updates
JonSpight Oct 21, 2024
ed93cb2
fixed files
JonSpight Oct 21, 2024
5329ab6
updated query reverted test case
JonSpight Oct 22, 2024
2995d39
Merge branch 'main' of https://github.com/transcom/mymove into B-2052…
JonSpight Oct 22, 2024
856f782
Merge branch 'B-20526-main' into B-20526-int
JonSpight Oct 22, 2024
8fe894a
fixed files
JonSpight Oct 22, 2024
a85bdc6
provides service counseling must be true
JonSpight Oct 22, 2024
db36404
Merge remote-tracking branch 'origin' into B-20526-main
JonSpight Oct 22, 2024
71da476
Merge remote-tracking branch 'origin' into B-20526-int
JonSpight Oct 22, 2024
a48c9bd
Merge branch 'B-20526-main' into B-20526-int
JonSpight Oct 22, 2024
fa498d6
Merge branch 'integrationTesting' into B-20526-int
JonSpight Oct 22, 2024
8cb527a
fixed test file
JonSpight Oct 22, 2024
68ea649
Merge branch 'B-20526-main' into B-20526-int
JonSpight Oct 22, 2024
c364a18
Merge branch 'B-20526-int' of https://github.com/transcom/mymove into…
JonSpight Oct 22, 2024
312a662
revert zipcode
JonSpight Oct 22, 2024
43801cb
Merge branch 'integrationTesting' into B-20526-int
JonSpight Oct 22, 2024
8a2ff9d
Merge branch 'integrationTesting' into B-20526-int
JonSpight Oct 22, 2024
9bb2e88
Merge branch 'integrationTesting' into B-20526-int
JonSpight Oct 23, 2024
c7950fc
Merge branch 'integrationTesting' into B-20526-int
JonSpight Oct 23, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion config/tls/dod-sw-ca-75.pem
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ dIfLjWrPbLuPSKLxJlPqME1q962+ql+f5Mg5w9CeBi1ORJynkX/yz332sydCgQ3G
kLz8YRyvZH5Jrdg6vDQr4qFMt2kmBUIWq7UDI/G1fmUI7Q7R7qsfnyHhqOdUNBNi
is8yooe7hRBl0TaIiNCmItMFaTl7G38ZI8gL2prAGNHITpTjbaWrlC2CYCgtCoWo
GmlNqlYB/qPgCvk50sSvxFL7dQ==
-----END CERTIFICATE-----
-----END CERTIFICATE-----
Original file line number Diff line number Diff line change
Expand Up @@ -138,20 +138,29 @@ func findCounselingOffice(appCtx appcontext.AppContext, dutyLocationID uuid.UUID
var officeList []models.TransportationOffice

sqlQuery := `
with counseling_offices as (
SELECT transportation_offices.id, transportation_offices.name
FROM postal_code_to_gblocs
JOIN addresses on postal_code_to_gblocs.postal_code = addresses.postal_code
JOIN duty_locations on addresses.id = duty_locations.address_id
JOIN transportation_offices on postal_code_to_gblocs.gbloc = transportation_offices.gbloc
WHERE duty_locations.provides_services_counseling = true and duty_locations.id = $1
with counseling_offices as (
SELECT transportation_offices.id, transportation_offices.name, transportation_offices.address_id as counseling_address, substring(addresses.postal_code, 1,3 ) as origin_zip, substring(a2.postal_code, 1,3 ) as dest_zip
FROM postal_code_to_gblocs
JOIN addresses on postal_code_to_gblocs.postal_code = addresses.postal_code
JOIN duty_locations on addresses.id = duty_locations.address_id
JOIN transportation_offices on postal_code_to_gblocs.gbloc = transportation_offices.gbloc
join addresses a2 on a2.id = transportation_offices.address_id
WHERE duty_locations.provides_services_counseling = true and duty_locations.id = $1
)
SELECT counseling_offices.id, counseling_offices.name
SELECT counseling_offices.id, counseling_offices.name
FROM counseling_offices
JOIN duty_locations duty_locations2 on counseling_offices.id = duty_locations2.transportation_office_id
JOIN addresses on counseling_offices.counseling_address = addresses.id
LEFT JOIN zip3_distances ON (
(substring(addresses.postal_code,1 ,3) = zip3_distances.to_zip3
AND counseling_offices.origin_zip = zip3_distances.from_zip3)
OR
(substring(addresses.postal_code,1 ,3) = zip3_distances.from_zip3
AND counseling_offices.origin_zip = zip3_distances.to_zip3)
)
WHERE duty_locations2.provides_services_counseling = true
GROUP BY counseling_offices.id, counseling_offices.name
ORDER BY counseling_offices.name asc`
group by counseling_offices.id, counseling_offices.name, zip3_distances.distance_miles
ORDER BY coalesce(zip3_distances.distance_miles,0), counseling_offices.name asc`

query := appCtx.DB().Q().RawQuery(sqlQuery, dutyLocationID)
if err := query.All(&officeList); err != nil {
Expand Down