artfulrobot / mailchimpsync

CiviCRM Extension providing Mailchimp Sync
Other
4 stars 0 forks source link

Show recent failures #11

Closed artfulrobot closed 4 years ago

artfulrobot commented 4 years ago

The status says "in sync" despite there being people who can't be sync-ed. It's more that it's 'reconciled' rather than actually in sync.

Some failures are longstanding and uninteresting, e.g. the person who has 2 email addresses on one contact record, one email is unsubscribed at Mailchimp and the other is subscribed. They can safely be left as faliures.

But others might need investigation, especially when they're recent.

Showing a count per list of recent failures might help people who monitor these things iron out awkward cases.

Something like this:

select count(*) 
from civicrm_mailchimpsync_cache mc 
inner join civicrm_mailchimpsync_update u on mc.id = u.mailchimpsync_cache_id 
and u.error_response is not null and u.error_response != '' 
inner join civicrm_mailchimpsync_batch b on u.mailchimpsync_batch_id = b.id 
where b.completed_at >= CURRENT_TIMESTAMP - INTERVAL 1 WEEK;