fix(campaigns/list): "Envois" column counted only status=sent

After Mailjet's Event API webhook moves rows from 'sent' to 'opened' or
'clicked', the counters.sent bucket empties and the list page showed
0/N even though every email had successfully landed. Use the same
sent+opened+clicked sum as the detail page so the list reflects
"emails that left our SMTP" rather than "emails still flagged sent".

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
louispaulb 2026-05-22 09:11:15 -04:00
parent 2bc9715485
commit bf1253ac58

View File

@ -34,9 +34,9 @@
<template v-slot:body-cell-progress="props">
<q-td :props="props">
<div class="row items-center q-gutter-xs">
<span class="text-grey-7">{{ (props.row.counters?.sent || 0) }} / {{ props.row.total || 0 }}</span>
<span class="text-grey-7">{{ sentCount(props.row) }} / {{ props.row.total || 0 }}</span>
<q-linear-progress
:value="(props.row.counters?.sent || 0) / Math.max(1, props.row.total || 1)"
:value="sentCount(props.row) / Math.max(1, props.row.total || 1)"
size="6px"
:color="props.row.counters?.failed ? 'negative' : 'positive'"
style="min-width:80px"
@ -71,6 +71,14 @@ const columns = [
{ name: 'actions', label: '', field: '', align: 'right' },
]
// "Envoyés" = anything past the SMTP handoff. Webhooks (Mailjet Event API)
// promote 'sent' rows to 'opened' / 'clicked' over time, so counting only
// counters.sent would (incorrectly) drop the displayed count back to 0 once
// recipients start opening their emails. Matches the detail-page convention.
function sentCount (row) {
const c = row?.counters || {}
return (c.sent || 0) + (c.opened || 0) + (c.clicked || 0)
}
function statusColor (s) {
return { draft: 'grey', sending: 'orange', completed: 'positive', failed: 'negative' }[s] || 'grey'
}