Commit Graph

72 Commits

Author SHA1 Message Date
4d5b4885fe Revert valid operator methods back to instance methods
MAILPOET-4989
2023-07-26 10:53:55 +02:00
8de46db560 Add note about the different naming format
The subscribedDate filter used to be completely separate and it's now
been consolidated into SubscriberDateField. Since existing filters exist
 in the wild that have the subscribedDate type, we're not able to
 update the value to be consistent with the other types.

MAILPOET-4989
2023-07-26 10:53:55 +02:00
edbb40ee42 Add last sending date filter
MAILPOET-4989
2023-07-26 10:53:55 +02:00
3ded9be927 Refactor subscribedDate filter to use SubscriberDateField
MAILPOET-4989
2023-07-26 10:53:55 +02:00
f27f469b17 Add backend logic for subscriber date filters
MAILPOET-4989
2023-07-26 10:53:55 +02:00
7db7e78c71 Add backend logic for onOr(Before|After) filters
MAILPOET-5012
2023-07-19 16:06:19 +02:00
9a218a706b Refactor single order value and total spent to use DaysPeriodField
This commit refactors the React components SingleOrderValueFields and
TotalSpentFields to use the new DaysPeriodField component instead of
its own code to generate the days period selector.

[MAILPOET-4991]
2023-07-19 15:24:46 +02:00
8a2c435b9c Refactor average spent and # of orders to use DaysPeriodField
This commit refactors the React components AverageSpentFields and
NumberOfOrdersFields to use the new DaysPeriodField component instead of
a its own code to generate the days period selector.

[MAILPOET-4991]
2023-07-19 15:24:46 +02:00
251dcdc6fb Add filters for automations events
MAILPOET-5003
2023-07-12 11:10:18 +02:00
841745c706 Remove shipping method IDs from the 'used shipping method' query
This commit simplifies the logic of the 'used shipping method' segment
by removing the shipping method IDs from the queries. After some
considering, we have come to the conclusion that using just the shipping
method instance ID is enough.

[MAILPOET-4992]
2023-07-04 22:23:06 +02:00
f20878f7f3 Update the queries of the 'used shipping method' filter
This commit changes the logic of the code that builds the queries for
the 'used shipping method' filter. The initial implementation relied
only on the shipping method name that is stored in
wp_woocommerce_order_items.  This implementation did not work as the
name is not unique. The new implementation use the shipping method id
and the instance id that are stored in wp_woocommerce_order_itemmeta and
the combination of both fields is unique.

[MAILPOET-4992]
2023-07-04 22:23:06 +02:00
993e292fd0 Fix typo
[MAILPOET-4992]
2023-07-04 22:23:06 +02:00
5447e253e5 Add backend logic to handle new "used shipping method" segment
[MAILPOET-4992]
2023-07-04 22:23:06 +02:00
2a012f5fc8 Add braces to if statements
MAILPOET-4990
2023-06-28 15:14:03 +02:00
2db454bc49 Fix exception codes
MAILPOET-4990
2023-06-28 15:14:03 +02:00
61bb3a65d7 Add backend logic for customer text field filters
MAILPOET-4990
2023-06-28 15:14:03 +02:00
b018918bc4 Extract (soon to be) shared text field operators
MAILPOET-4990
2023-06-28 15:14:03 +02:00
de3d3a5fe2 Fix: subscriber segmentation can now target contacts who did not open any emails
There was a bug in the query that is used to get the subscribers that
opened emails that was preventing it from working when trying to get
subscribers that opened zero emails.

The problem was that we were adding the user_agent_type	as a condition
on the WHERE part of the clause. Meaning that it was being used to
filter the overall results and thus excluding all subscribers that had
no entries in the wp_mailpoet_statistics_opens table. By moving this
condition to the ON clause in the LEFT JOIN, we use the user_agent_type
field to match rows between tables. The value of this field will still
be taken into consideration when counting the number of opens as we are
counting the number of entries in the wp_mailpoet_statistics_opens
table.

[MAILPOET-5347]
2023-06-05 13:46:43 +02:00
43ee076562 Change the behavior of the country segment
This commit changes the behavior of the country segment to include
subscribers that never placed an order (or placed orders that failed or
were canceled) as long as they have a country set in the WooCommerce
customer lookup table.

[MAILPOET-4188]
2023-06-05 12:26:03 +02:00
ec68818c1a Add filter for used payment method
MAILPOET-4993
2023-05-19 11:57:13 +02:00
e636537580 Add ability to duplicate dynamic segments
MAILPOET-4635
2023-05-15 13:48:41 +02:00
974cd32950 Dynamic segment filter for first/last name and email
MAILPOET-4997
2023-05-12 13:59:12 +02:00
9e5b5d5ebe Add backend error checking for average spent filter
MAILPOET-4987
2023-05-11 11:47:01 +02:00
d8e29e9edb Prefix average spent fields
MAILPOET-4987
2023-05-11 11:47:01 +02:00
ca2a6ceac8 Add missing options and fix order of options
MAILPOET-4987
2023-05-11 11:47:01 +02:00
46316b48e2 Clean up code left over after refactoring
MAILPOET-4987
2023-05-11 11:47:01 +02:00
a2853236fc Add average order value filter
MAILPOET-4987
2023-05-11 11:47:01 +02:00
f75173dcd5 Add "subscribed via form" dynamic filter
MAILPOET-5005
2023-05-09 13:10:08 +02:00
8a66c83257 Add "was sent email" filter
MAILPOET-5004
2023-05-01 11:28:25 +02:00
119dcbd5b5 Sanitize name and description when creating a segment
This commits adds the sanitization right before the data is added to the
database (\MailPoet\Segments\SegmentsRepository::createOrUpdate()) and
removes the sanitization from
\MailPoet\Segments\DynamicSegments\SegmentSaveController::save() to
avoid sanitizing twice. save() calls createOrUpdate().

Before this commit, we were sanitizing the name and description of
dynamic segments but not regular segments.

[MAILPOET-5232]
2023-04-17 14:33:51 -03:00
8700178f01 Remove debug code
MAILPOET-5083
2023-04-13 17:56:13 +02:00
40fc3882f3 Use correct statuses for category filter
MAILPOET-5083
2023-04-13 17:56:13 +02:00
483acb0040 Use correct statuses for single order value
MAILPOET-5083
2023-04-13 17:56:13 +02:00
30c8ce0839 Use correct statuses for total spent
MAILPOET-5083
2023-04-13 17:56:13 +02:00
2caa535098 Use correct statuses for product filter
MAILPOET-5083
2023-04-13 17:56:13 +02:00
aa7bd6eb67 Use correct statuses for number of orders filter
MAILPOET-5083
2023-04-13 17:56:13 +02:00
03da98e5df Avoid simple text replacements in SQL if possible
MAILPOET-4986
2023-04-03 10:20:02 +02:00
1cab4a944a Use standard joins where possible
MAILPOET-4986
2023-04-03 10:20:02 +02:00
509a79fd1a Proper method naming
MAILPOET-4986
2023-04-03 10:20:02 +02:00
68902a206d Extract more to helpers
MAILPOET-4986
2023-04-03 10:20:02 +02:00
26ec430942 Refactor to use DI instead of inheritance
MAILPOET-4986
2023-04-03 10:20:02 +02:00
fa43495d81 Minor refactoring
MAILPOET-4986
2023-04-03 10:20:02 +02:00
c747b71829 Simplify subquery
MAILPOET-4986
2023-04-03 10:20:02 +02:00
d505bffcfd Refactor to use shared date functionality
MAILPOET-4986
2023-04-03 10:20:02 +02:00
caba21b8af Fix relative date calculation
MAILPOET-4986
2023-04-03 10:20:02 +02:00
d52113d104 Extract shared date filter functionality
MAILPOET-4986
2023-04-03 10:20:02 +02:00
37226202bc Implement purchase date dynamic filter
MAILPOET-4986
2023-04-03 10:20:02 +02:00
b963d8b988 Add a new WooCommerce segment based on the value of the orders
[MAILPOET-4988]
2023-03-28 15:51:01 +02:00
58b2ac4a60 Add collation check to WooSubscriptions filter
We join using a string column and it may cause errors when the columns
using different collation. This commit adds collation check so that we can alter
collation in the join condition in case it is needed.
[MAILPOET-4568]
2023-03-27 12:26:35 +02:00
bb9b04ecc8 Update WooSubscription filter to work with HPOS data
The wc_orders table doesn't contain user_id but has billing_email and customer_id.
These were two options I could use for joining subscribers table.
I could use the customer_id but I would have to join wc_customer_lookup table and then
the orders table. Instead of customer_id I chose the billing_email. Both tables have
indexes on the email columns and it is one join instead of two.
[MAILPOET-4568]
2023-03-27 12:26:35 +02:00