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

Relocate #get_facility_timezone to appointments_service.rb #16720

Merged
merged 6 commits into from
May 20, 2024

Conversation

Tonksthebear
Copy link
Contributor

Summary

In an ongoing effort to keep the business logic of appointments the same between Web and Mobile, this PR relocates the get_facility_timezone to the appointments_service

Related issue(s)

department-of-veterans-affairs/va-mobile-app#8571

Testing done

Existing tests cover the use cases

Screenshots

Note: Optional

What areas of the site does it impact?

(Describe what parts of the site are impacted andifcode touched other areas)

Acceptance criteria

  • I fixed|updated|added unit tests and integration tests for each feature (if applicable).
  • No error nor warning in the console.
  • Events are being sent to the appropriate logging solution
  • Documentation has been updated (link to documentation)
  • No sensitive information (i.e. PII/credentials/internal URLs/etc.) is captured in logging, hardcoded, or specs
  • Feature/bug has a monitor built into Datadog or Grafana (if applicable)
  • If app impacted requires authentication, did you login to a local build and verify all authenticated routes work as expected
  • I added a screenshot of the developed feature

Requested Feedback

(OPTIONAL)What should the reviewers know in addition to the above. Is there anything specific you wish the reviewer to assist with. Do you have any concerns with this PR, why?

@@ -297,17 +287,6 @@ def get_clinic_memoized(location_id, clinic_id)
end
memoize :get_clinic_memoized

def get_facility_memoized(location_id)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I also relocated this function as #get_facility_timezone depended on it as well. The appointments service already had get_facility so I'm not sure why the memoized version wasn't already in there as well

@@ -460,26 +504,7 @@ def convert_utc_to_local_time(date, tz)
end
end

# Returns the facility timezone id (eg. 'America/New_York') associated with facility id (location_id)
def get_facility_timezone_memoized(facility_location_id)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I made both get_facility_timezone_momoized and get_facility public as they're used outside of the service. Lmk if there are any considerations I'm missing by doing that

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think you necessarily need to do this. I think ideally the fields that use these functions would be returned in the appts list. For example, get_facility_timezone_memoized is always used to set facility_timezone but if that data was just available in the appts list returned from the service then the downstream controllers and serializers wouldn't need access to get_facility_timezone_memoized. Similar logic goes for get_facility. That being said I'm fine with doing this for now and making a new ticket to follow up with the concept above if get_facility is fairly complex

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm do you think there's any concern with automatically doing another upstream fetch? Is there any scenario where we'd want the appointment info separate from facility info? I'm happy to make that change if you'd rather just have it done in this pr

Copy link
Contributor

Choose a reason for hiding this comment

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

Let's just leave it as is, but please make another ticket to follow up with the engineers from the appts team about baking this into the service response because I think at the end of all of this migration stuff the ideal situation is that the controllers (web and mobiles) are doing little to nothing other than serializing the data received from the service

jperk51
jperk51 previously approved these changes May 15, 2024
@Tonksthebear Tonksthebear merged commit 5b7820a into master May 20, 2024
19 checks passed
@Tonksthebear Tonksthebear deleted the move-get-facility-time-zone branch May 20, 2024 19:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants