Skip to content

Conversation

@kavyakapoor420
Copy link

…, update usages

Pull Request

Description

Refactored the [get_start_datetime] function in (utils.py) to split out logic into smaller, single-responsibility functions.
Added (_parse_n_history_days, _get_yesterday_midnight_utc, and validate_start_datetime) helper functions as also suggested in implementation of the given issue.

As suggested in implementation of this issue

Updated all usages in the codebase to use the new functions appropriately.

i have first done changes in utils.py then for second point i updated usage of function everywhere other in code .

This improves code clarity, maintainability, and makes the logic easier to follow and test.
No external API or behavioral changes — only internal refactor.
No new dependencies were required for this change.

Fixes #485

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce.
Please also list any relevant details for your test configuration

  • Ran all existing tests to verify correctness and ensure no regressions
  • Manually checked that all usages of the refactored functions behave as before

If your changes affect data processing, have you plotted any changes? i.e. have you done a quick sanity check?

  • N/A

Checklist:

  • My code follows OCF's coding style guidelines
  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • I have checked my code and corrected any misspellings

Copy link
Contributor

@braddf braddf left a comment

Choose a reason for hiding this comment

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

Hey @kavyakapoor420, thanks for this – could you just clarify if there are any changes compared with the suggested code in the Issue?
Otherwise looks good, and if all tests are passing then maybe double check if there are any helpful test cases missing, otherwise should be okay to merge 👍

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.

Refactor get_start_datetime function

2 participants