Simplify operator report email body
- Device: shows only hostname (not name) - Removed Asset Number line - Machine#: shows only machine number as clickable link (if relationship exists) - Keep Reason, Reported, Details, and Screenshot
This commit is contained in:
@@ -3012,7 +3012,6 @@ def _send_operator_report_alert(report, asset_id, hostname):
|
|||||||
machine_body_line = ''
|
machine_body_line = ''
|
||||||
if machine_info:
|
if machine_info:
|
||||||
safe_machine_number = escape(machine_info['assetnumber'] or 'N/A')
|
safe_machine_number = escape(machine_info['assetnumber'] or 'N/A')
|
||||||
safe_machine_name = escape(machine_info['name'] or safe_machine_number)
|
|
||||||
try:
|
try:
|
||||||
scheme = request.scheme if request else 'https'
|
scheme = request.scheme if request else 'https'
|
||||||
host = request.host if request else 'localhost'
|
host = request.host if request else 'localhost'
|
||||||
@@ -3021,7 +3020,7 @@ def _send_operator_report_alert(report, asset_id, hostname):
|
|||||||
machine_url = f'https://localhost/shopdb/machines/{machine_info["assetid"]}'
|
machine_url = f'https://localhost/shopdb/machines/{machine_info["assetid"]}'
|
||||||
|
|
||||||
machine_subject_part = f' (Machine #{safe_machine_number})'
|
machine_subject_part = f' (Machine #{safe_machine_number})'
|
||||||
machine_body_line = f'<p style="margin: 0;"><strong>Machine:</strong> <a href="{escape(machine_url)}">{safe_machine_name}</a> (#{safe_machine_number})</p>'
|
machine_body_line = f'<p style="margin: 0;"><strong>Machine#:</strong> <a href="{escape(machine_url)}">{safe_machine_number}</a></p>'
|
||||||
|
|
||||||
# Build HTML body (don't use render_email to avoid subject duplication)
|
# Build HTML body (don't use render_email to avoid subject duplication)
|
||||||
html_body = f'''
|
html_body = f'''
|
||||||
@@ -3029,8 +3028,7 @@ def _send_operator_report_alert(report, asset_id, hostname):
|
|||||||
<h2 style="color:#1a1a1a;margin:0 0 12px;">Operator Issue Report</h2>
|
<h2 style="color:#1a1a1a;margin:0 0 12px;">Operator Issue Report</h2>
|
||||||
<div style="padding: 16px; background: #f9f9f9; border-left: 4px solid #d93f3f; margin-bottom: 16px;">
|
<div style="padding: 16px; background: #f9f9f9; border-left: 4px solid #d93f3f; margin-bottom: 16px;">
|
||||||
<p style="margin: 0 0 8px; font-weight: bold; color: #d93f3f;">New Issue Report from Shop Floor</p>
|
<p style="margin: 0 0 8px; font-weight: bold; color: #d93f3f;">New Issue Report from Shop Floor</p>
|
||||||
<p style="margin: 0;"><strong>Device:</strong> <a href="{escape(device_url)}">{safe_name}</a> ({safe_hostname})</p>
|
<p style="margin: 0;"><strong>Device:</strong> <a href="{escape(device_url)}">{safe_hostname}</a></p>
|
||||||
<p style="margin: 0;"><strong>Asset Number:</strong> <a href="{escape(device_url)}">{safe_assetnumber}</a></p>
|
|
||||||
{machine_body_line}
|
{machine_body_line}
|
||||||
<p style="margin: 0;"><strong>Reason:</strong> {safe_reason}</p>
|
<p style="margin: 0;"><strong>Reason:</strong> {safe_reason}</p>
|
||||||
<p style="margin: 0;"><strong>Reported:</strong> {escape(reported_at)}</p>
|
<p style="margin: 0;"><strong>Reported:</strong> {escape(reported_at)}</p>
|
||||||
|
|||||||
Reference in New Issue
Block a user