Skip to content

Commit

Permalink
Split up warnings in email
Browse files Browse the repository at this point in the history
  • Loading branch information
jayvarner committed Nov 25, 2024
1 parent fb371df commit 4e9f395
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
6 changes: 5 additions & 1 deletion readux_ingest_ecds/mail.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,13 @@ def send_email_on_success(creator=None, manifest=None, warnings=None):
)
context["manifest_pid"] = manifest.pid
context["volume_url"] = manifest.get_volume_url()
context["warnings"] = (
ingest_warnings = (
warnings if warnings is not None and len(warnings) > 10 else None
)
context["warnings"] = (
ingest_warnings.split("$$$$") if ingest_warnings is not None else None
)

html_email = get_template("ingest_ecds_success_email.html").render(context)
text_email = get_template("ingest_ecds_success_email.txt").render(context)
if creator is not None:
Expand Down
2 changes: 1 addition & 1 deletion readux_ingest_ecds/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def add_ocr_task_local(ingest_id, manifest_pid, *args, **kwargs):
local_ingest = Local.objects.get(pk=ingest_id)
manifest = Manifest.objects.get(pk=local_ingest.manifest.pk)
warnings = add_ocr_to_canvases(manifest)
local_ingest.warnings = "\n".join(warnings)
local_ingest.warnings = "$$$$".join(warnings)
local_ingest.save()


Expand Down
6 changes: 5 additions & 1 deletion readux_ingest_ecds/templates/ingest_ecds_success_email.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,9 @@ <h3 style="color: green;">Ingest complete: {{ manifest_pid }}</h3>
</p>
{% if warnings is not None %}
<p>Warnings</p>
<p>{{warnings}}</p>
<ul>
{% for warning in warnings %}
<li>{{ warning }}</li>
{% endfor %}
</ul>
{% endif %}
2 changes: 1 addition & 1 deletion readux_ingest_ecds/templates/ingest_ecds_success_email.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ Ingest complete: {{ manifest_pid }}
- Link to volume: {{ volume_url }}
{% if warnings is not None %}
- Warnings:
{{ warnings }}
{{ warnings|join:"\n" }}
{% endif %}

0 comments on commit 4e9f395

Please sign in to comment.