Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 33 additions & 4 deletions app/Seeders/FailedExportTemplateSeeder.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,23 +44,46 @@ private function getDefaultTemplateData(): array
'subject' => 'Failed Export Executions',
'isHtml' => true,
'createdAt' => date('Y-m-d H:i:s'),
'body' => "<h1>Failed Export Executions</h1>
'body' => "<style>
* {
font-family: sans-serif;
}

table, th, td {
border: 1px solid #999;
border-collapse: collapse;
}

th, td {
text-align: center;
padding: 15px;
}

{% set jobs = findEntities('ExportJob', {'state': 'Failed', 'createdAt>=': 'now' | date_modify('-1 days') | date('Y-m-d H:i:s')}) %}
th:first-of-type,
td:first-of-type {
text-align: left;
}
</style>

<h1>Failed Export Executions</h1>

{% set jobs = findEntities('ExportJob', {'state': 'Failed', 'exportFeedId!=': 'no-such-id', 'createdAt>=': 'now' | date_modify('-1 days') | date('Y-m-d H:i:s')}) %}

{% set feeds = {} %}
{% set feedNames = {} %}
{% set total = 0 %}
{% for job in jobs %}
{% set feeds = feeds|merge({(job.exportFeedId): (feeds[job.exportFeedId] ?? 0) + 1}) %}
{% set total = total + 1 %}
{% endfor %}

<br/>

<table>
<thead>
<tr>
<th style=\"text-align: left;\">Feed</th>
<th>Failed Jobs count</th>
<th>Feed</th>
<th>Failed</th>
</tr>
</thead>
<tbody>
Expand All @@ -71,6 +94,12 @@ private function getDefaultTemplateData(): array
<td><b>{{ count }}</b></td>
</tr>
{% endfor %}
{% if total > 0 %}
<tr>
<td><b>Total</b></td>
<td><b>{{ total }}</b></td>
</tr>
{% endif %}
</table>
",
];
Expand Down