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

Major filter refactor #2736

Merged
merged 44 commits into from
Jan 5, 2021
Merged

Major filter refactor #2736

merged 44 commits into from
Jan 5, 2021

Conversation

EDsCODE
Copy link
Member

@EDsCODE EDsCODE commented Dec 10, 2020

Changes

Please describe.

  • use mixin to modularize filter objects. This will allow clear additions/removal to a filter and compartmentalize where the logic/defaults are handled
  • add dedicated path filter
  • to_dict arguments will be handled within scope

Checklist

  • Some way to create a mixin factory? without losing type clarity
  • Make sure that to_dict and tojson produce filters that are cache consistent
  • All querysets/queries filter by Organization, by Team, and by User
  • Django backend tests
  • Jest frontend tests
  • Cypress end-to-end tests

@@ -36,7 +37,207 @@
from posthog.utils import relative_date_parse


class Filter(PropertyMixin):
class DisplayMixin:
Copy link
Member Author

Choose a reason for hiding this comment

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

I fiddled with a factory pattern here but resorted to doing a more straightforward pattern for now

@timgl timgl temporarily deployed to posthog-major-filter-re-urszdp December 10, 2020 22:25 Inactive
if target_entity_data:
data = json.loads(target_entity_data)
return Entity({"id": data["id"], "type": data["type"]})
return None

def to_dict(self) -> Dict[str, Any]:
Copy link
Contributor

Choose a reason for hiding this comment

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

Note - we can probably automatically generate this method as well if we go the mixin route. :)

@EDsCODE EDsCODE had a problem deploying to posthog-major-filter-re-urszdp December 11, 2020 15:26 Failure
@EDsCODE EDsCODE temporarily deployed to posthog-major-filter-re-urszdp December 11, 2020 18:12 Inactive
@EDsCODE EDsCODE temporarily deployed to posthog-major-filter-re-urszdp December 11, 2020 18:55 Inactive
@EDsCODE EDsCODE temporarily deployed to posthog-major-filter-re-urszdp December 11, 2020 19:29 Inactive
@EDsCODE EDsCODE mentioned this pull request Dec 14, 2020
4 tasks
@EDsCODE EDsCODE temporarily deployed to posthog-major-filter-re-urszdp December 14, 2020 15:18 Inactive
@EDsCODE EDsCODE temporarily deployed to posthog-major-filter-re-urszdp December 14, 2020 16:04 Inactive
@EDsCODE EDsCODE marked this pull request as ready for review December 14, 2020 17:37
posthog/types.py Outdated Show resolved Hide resolved
@EDsCODE EDsCODE temporarily deployed to posthog-major-filter-re-urszdp December 16, 2020 21:51 Inactive
@EDsCODE EDsCODE temporarily deployed to posthog-major-filter-re-urszdp December 16, 2020 22:07 Inactive
@EDsCODE EDsCODE temporarily deployed to posthog-major-filter-re-urszdp December 16, 2020 22:21 Inactive
@EDsCODE EDsCODE temporarily deployed to posthog-major-filter-re-urszdp December 17, 2020 14:25 Inactive
@EDsCODE EDsCODE temporarily deployed to posthog-major-filter-re-urszdp December 17, 2020 16:10 Inactive
@EDsCODE EDsCODE temporarily deployed to posthog-major-filter-re-urszdp December 17, 2020 17:33 Inactive
@EDsCODE EDsCODE temporarily deployed to posthog-major-filter-re-urszdp December 17, 2020 18:13 Inactive
@EDsCODE EDsCODE temporarily deployed to posthog-major-filter-re-urszdp December 17, 2020 19:41 Inactive
@EDsCODE EDsCODE temporarily deployed to posthog-major-filter-re-urszdp December 17, 2020 22:38 Inactive
@EDsCODE EDsCODE temporarily deployed to posthog-major-filter-re-urszdp December 17, 2020 22:53 Inactive
@EDsCODE EDsCODE requested a review from timgl December 18, 2020 13:48
@timgl timgl merged commit 4ece4ce into master Jan 5, 2021
@timgl timgl deleted the major-filter-refactor branch January 5, 2021 11:15
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

3 participants