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

Add 'has' filter to CaseCollection #328

Merged
merged 5 commits into from
Jun 13, 2024
Merged

Add 'has' filter to CaseCollection #328

merged 5 commits into from
Jun 13, 2024

Conversation

rwiker
Copy link
Contributor

@rwiker rwiker commented Jun 13, 2024

Issue

#325

Short description

  1. The CaseCollection constructor and the method CaseCollection.filter() have a new optional parameter called has. The filter() method generally returns a new CaseCollection instance; if has is specified, it is passed on to the constructor, which stores it in the member slot _has.
  2. All searches on a DocumentCollection involve the _next_batch()/_next_batch_async() methods. These methods are overridden by CaseCollection.
  3. _next_batch()/_next_batch_async() for CaseCollection checks if the member slot _has is set. If it is, we
    • Run a query to get all the values for fmu.case.uuid for the existing filters for the CaseCollection instance.
    • Create a new query that combines the value of _has with the set of values for fmu.case.uuid. Note: this new query applies to all object types, and not just case objects.
    • Retrieve all values for fmu.case.uuid for this new query.
    • Change the current filter for the CaseCollection instance to something like {"ids": {"values": <uuids>}}
    • Set the _hasmember attribute to None.
  4. After checking/handling the _has attribute, _next_batch()/_next_batch_async() passes control to the parent class implementation.

Pre-review checklist

  • Read through all changes. No redundant print() statements, commented-out code, or other remnants from the development. 👀
  • [✅] Make sure tests pass after every commit. ✅
  • [✅] New/refactored code is following same conventions as the rest of the code base. 🧬
  • [✅] New/refactored code is tested. ⚙
  • [✅] Documentation has been updated 🧾

Pre-merge checklist

  • Commit history is consistent and clean. 👌

@rwiker rwiker requested a review from a team June 13, 2024 08:38
@rwiker rwiker linked an issue Jun 13, 2024 that may be closed by this pull request
@rwiker rwiker changed the title Case has filter Add 'has' filter to CaseCollection Jun 13, 2024
Copy link
Contributor

@equinor-ruaj equinor-ruaj left a comment

Choose a reason for hiding this comment

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

lgtm

@rwiker rwiker merged commit 4b4a36f into main Jun 13, 2024
25 checks passed
@rwiker rwiker deleted the case-has-filter branch June 13, 2024 08:54
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.

Add "has" filter to cases
2 participants