SIENTIAPDE-1172
refactor: streamline email generation and enhance notification handling - Updated email HTML structure to improve clarity and presentation of notifications. - Enhanced notification generator to better manage execution counts and output formatting. - Refactored Email class to improve error handling and logging during email sending. - Adjusted EmailBuilder to efficiently process error, warning, and info models. - Improved test coverage for email and notification functionalities to ensure reliability.
This commit is contained in:
@@ -31,11 +31,14 @@ class EmailBuilder:
|
||||
return {
|
||||
'mail_type': mail_type,
|
||||
'error_events': self.replace_parameters(self.general_template,
|
||||
error_models) if error_models else '',
|
||||
general_events.get(
|
||||
'ERROR')) if error_models else '',
|
||||
'warning_events': self.replace_parameters(self.general_template,
|
||||
warning_models) if warning_models else '',
|
||||
general_events.get(
|
||||
'WARNING')) if warning_models else '',
|
||||
'info_events': self.replace_parameters(self.general_template,
|
||||
info_models) if info_models else '',
|
||||
general_events.get(
|
||||
'INFO')) if info_models else '',
|
||||
}
|
||||
|
||||
def build_email(self, report_data: list[dict], mail_type: str) -> str:
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Notification ID</th>
|
||||
<th>Schedule</th>
|
||||
<th>Block</th>
|
||||
<th>Timestamp</th>
|
||||
<th>Message</th>
|
||||
@@ -14,6 +15,7 @@
|
||||
{% for event in model.events %}
|
||||
<tr>
|
||||
<td>{{ event.notification_id }}</td>
|
||||
<td>{{ event.trigger }}</td>
|
||||
<td>{{ event.block }}</td>
|
||||
<td>{{ event.timestamp }}</td>
|
||||
<td>{{ event.message }}</td>
|
||||
|
||||
Reference in New Issue
Block a user