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

filter more in the pass #269

Merged
merged 3 commits into from
Mar 13, 2024
Merged

filter more in the pass #269

merged 3 commits into from
Mar 13, 2024

Conversation

peterdudfield
Copy link
Contributor

@peterdudfield peterdudfield commented Mar 13, 2024

Pull Request

Description

We get a bug in the read function if both start_datetime and created_utc_limit are set

Before we had

query = query.filter(model.target_time >= start_datetime)
query = query.filter(model.created_utc <= created_utc_limit)
query = query.filter(ForecastSQL.created_utc >= start_datetime - timedelta(1day))

This was a problem if the created_utc_limit was more than a day before the start_datetime

we now have

query = query.filter(model.target_time >= start_datetime)
query = query.filter(model.created_utc <= created_utc_limit)
query = query.filter(ForecastSQL.created_utc >= min(start_datetime,created_utc_limit) - timedelta(1day))

Helps with openclimatefix/uk-pv-national-gsp-api#327

How Has This Been Tested?

CI tests

  • added a test, that fails without the change

  • Yes

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

codecov bot commented Mar 13, 2024

Codecov Report

Attention: Patch coverage is 66.66667% with 1 lines in your changes are missing coverage. Please review.

Project coverage is 94.75%. Comparing base (fc3d90c) to head (53ec51d).
Report is 2 commits behind head on main.

❗ Current head 53ec51d differs from pull request most recent head 2111cce. Consider uploading reports for the commit 2111cce to get more accurate results

Files Patch % Lines
nowcasting_datamodel/read/read.py 66.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #269      +/-   ##
==========================================
- Coverage   94.81%   94.75%   -0.06%     
==========================================
  Files          24       24              
  Lines        1523     1525       +2     
==========================================
+ Hits         1444     1445       +1     
- Misses         79       80       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@peterdudfield peterdudfield merged commit 34808fd into main Mar 13, 2024
2 checks passed
@peterdudfield peterdudfield deleted the bug/creation-time-filter branch March 13, 2024 16:24
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.

1 participant