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

[DPMMA-2187] Segment date filter and "equals" operator #13620

Open
wants to merge 3 commits into
base: 5.x
Choose a base branch
from

Conversation

annamunk
Copy link
Member

@annamunk annamunk commented Apr 9, 2024

Q A
Bug fix? (use the a.b branch) [✅]
New feature/enhancement? (use the a.x branch) [❌]
Deprecations? [❌]
BC breaks? (use the c.x branch) [❌]
Automated tests included? [✅]
Related user documentation PR URL mautic/mautic-documentation#...
Related developer documentation PR URL mautic/developer-documentation#...
Issue(s) addressed Fixes #...

Description:

This PR extends the validation of data fields using the equals/not equal operators. Using these operators for dates causes the segment to not rebuild properly. This is due to the fact that date-related data is stored in the form of datetime and comparing it with only the date or incomplete datetime in the query does not return the expected results. The value to be compared must be accurate to the second, comparison with only the day in the YYYY-MM-DD format or with the day and partial time does not return all relevant contacts. This PR does not remove operators for data fields so that segments that have already been saved with them can be opened for editing.

Steps to test this PR:

  1. Open this PR on Gitpod or pull down for testing locally (see docs on testing PRs here)
  2. Create new segment or edit existing one.
  3. Add a filter related to the date, e.g. Date added, select the "equals" or "not equal" operator and fill in the sample value "2024-04-15"
  4. Try saving the segment. The following message should appear
    date_added

@annamunk annamunk marked this pull request as draft April 9, 2024 14:53
Copy link
Member

@kuzmany kuzmany left a comment

Choose a reason for hiding this comment

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

Why YYYY-MM-DD should not work with equal expression? Do I miss something?

@annamunk
Copy link
Member Author

@kuzmany I noticed that using these operators with incomplete dates does not return correct results when rebuilding segments. The date would have to be accurate to the second. I assume that for such a specific time we can simply add selected contacts manually. If we need to specify an exact day or time, using another operator is a better idea.

@annamunk annamunk marked this pull request as ready for review April 19, 2024 10:48
@kuzmany
Copy link
Member

kuzmany commented Apr 19, 2024

@annamunk I think we fixed all things related to equal/not equal here #11835.

For example if today is 19.4.2024

date = -1 days (day = 18.4.2024)
datetime = - 1 days (datetime between -24 hours and -48 hours)

@RCheesley RCheesley changed the title WIP [DPMMA-2187] Segment date filter and "equals" operator [DPMMA-2187] Segment date filter and "equals" operator Apr 19, 2024
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

2 participants