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

fix(search): clear datetime between searches #171

Closed
wants to merge 2 commits into from

Conversation

sbrunato
Copy link

Fixes #170

Clears _start_date and _end_date Search class variables between model instances.

@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.20%. Comparing base (a927d25) to head (274d083).
Report is 81 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #171      +/-   ##
==========================================
- Coverage   96.59%   96.20%   -0.39%     
==========================================
  Files          25       25              
  Lines         587      606      +19     
==========================================
+ Hits          567      583      +16     
- Misses         20       23       +3     
Flag Coverage Δ
unittests 96.20% <100.00%> (-0.39%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

@vincentsarago
Copy link
Member

Thanks for the PR @sbrunato 🙏

I feel we will have the same problem in https://github.com/stac-utils/stac-fastapi/blob/c71a355c46e53af40cd9ebe23bc151fa9faf8776/stac_fastapi/extensions/stac_fastapi/extensions/core/collection_search/request.py#L114-L156

To me it seems weird that the class attribute are not reseted to None on class initialization. I guess there is something I don't understand 🤔

@sbrunato
Copy link
Author

I feel we will have the same problem in https://github.com/stac-utils/stac-fastapi/blob/c71a355c46e53af40cd9ebe23bc151fa9faf8776/stac_fastapi/extensions/stac_fastapi/extensions/core/collection_search/request.py#L114-L156

Yes, there is exactly the same issue in collection_search.

To me it seems weird that the class attribute are not reseted to None on class initialization.

I think that is because the attributes belong to the class, and are persistent through each new instantiation. Like in this:

>>> class Foo:
...     bar = None
... 
>>> Foo().bar
>>> Foo.bar = 1
>>> Foo().bar
1

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.

dates not cleared between searches
3 participants