In our own internal education, we've found that the following exercises work particularly well. They're all in sequence â the task to create for each subsequent exercise modifies the code you wrote previously.
Assignments
1. Auto-tag customers with @gmail.com email addresses, with "gmail"
Configure the task's event subscriptions appropriately
Support case-insensitivity â recognize "@gmail.com", and "@Gmail.com"
Ignore domains with more extensions â don't tag for "@gmail.com.au"
Make sure that any existing tags on the customer's account are kept, not lost
Use the REST API for this operation
4. Allow the merchant to configure the domain name to look for, and the tag to apply
Help the merchant make sure they enter a real domain name â return an error if the domain doesn't include a "."
Support case-insensitivity â if the merchant enters "Gmail.com", and the customer's email address ends with "@GMAIL.COM", they should still be tagged
5. Allow the merchant to add any number of domain name and customer tag pairings
6. Support responding to customer updates, in which the customer's email address changes
Remove any domain name tags that do not apply, and add the tag (if any that does apply
Do not remove any tags that contain a domain name tag â if the tag "google" should be removed, do not accidentally remove "google-foo"
Make this optional â allow the merchant to choose whether or not Mechanic listens for this
7. Move to GraphQL for removing and adding tags
8. Allow waiting a configurable number of minutes
Account for the customer tags or email address having changed during the waiting period
9. Create a backfill mode for processing all existing customers, that the merchant can run manually
Use {% for customer in shop.customers %}
for this operation
10. Move to GraphQL for scanning customers
11. Move to GraphQL bulk operations for scanning customers