From 7d83a8ccaad330b3f5805fb710d726c0b33cc94c Mon Sep 17 00:00:00 2001 From: kououken Date: Fri, 8 Mar 2019 12:43:47 -0800 Subject: [PATCH 1/4] Fixed booleans to appear as yes/no in emailed report --- back/.env | 8 ++++---- back/backend/templates/backend/email.html | 6 +++++- back/backend/templates/backend/email.txt | 2 +- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/back/.env b/back/.env index fbac74c..be096b6 100644 --- a/back/.env +++ b/back/.env @@ -1,4 +1,4 @@ -EMAIL_HOST_USER=accountemail@yourmail.com -EMAIL_HOST_PASSWORD=accountpasswordhere -SUBMIT_REPORT_DESTINATION_EMAIL=to-address@yourmail.com -SUBMIT_REPORT_FROM_EMAIL=from-address@yourmail.com \ No newline at end of file +EMAIL_HOST_USER=reimbursinator@gmail.com +EMAIL_HOST_PASSWORD=Frank12345 +SUBMIT_REPORT_DESTINATION_EMAIL=kououken@gmail.com +SUBMIT_REPORT_FROM_EMAIL=from-address@yourmail.com diff --git a/back/backend/templates/backend/email.html b/back/backend/templates/backend/email.html index 4bfb5f3..29a519e 100644 --- a/back/backend/templates/backend/email.html +++ b/back/backend/templates/backend/email.html @@ -12,7 +12,11 @@ {% for field in section.fields %} {{field.label}} - {{field.value|default:""}} + {% if field.field_type == 'boolean' %} + {{field.value|yesno:"yes,no"}} + {% else %} + {{field.value|default:" "}} + {% endif %} {% endfor %} {% for rule in section.rule_violations %} diff --git a/back/backend/templates/backend/email.txt b/back/backend/templates/backend/email.txt index 698f576..26c9ed4 100644 --- a/back/backend/templates/backend/email.txt +++ b/back/backend/templates/backend/email.txt @@ -8,7 +8,7 @@ Reference #: {{reference_number}} {% for section in sections %} {{section.title}}(SID: {{section.id}}) {% for field in section.fields %} - {{field.label}}: {{field.value|default:"empty"}} + {{field.label}}: {% if field.field_type == 'boolean' %}{{field.value|yesno:"yes,no"}}{% else %}{{field.value|default:" "}}{% endif %} {% endfor %} {% for rule in section.rule_violations %} [RULE] {{rule.label}}: {{rule.rule_break_text}} From 01139ad36156fc630c002db141b0567bc41a9015 Mon Sep 17 00:00:00 2001 From: kououken Date: Fri, 8 Mar 2019 12:57:07 -0800 Subject: [PATCH 2/4] Fixed bug where all sections were showing in text email. --- back/backend/templates/backend/email.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/back/backend/templates/backend/email.txt b/back/backend/templates/backend/email.txt index 26c9ed4..fcb1749 100644 --- a/back/backend/templates/backend/email.txt +++ b/back/backend/templates/backend/email.txt @@ -5,7 +5,7 @@ Title: {{title}} Reference #: {{reference_number}} -{% for section in sections %} +{% for section in sections %}{% if section.completed %} {{section.title}}(SID: {{section.id}}) {% for field in section.fields %} {{field.label}}: {% if field.field_type == 'boolean' %}{{field.value|yesno:"yes,no"}}{% else %}{{field.value|default:" "}}{% endif %} @@ -13,4 +13,4 @@ Reference #: {{reference_number}} {% for rule in section.rule_violations %} [RULE] {{rule.label}}: {{rule.rule_break_text}} {% endfor %} -{% endfor %} +{% endif %}{% endfor %} From 305ac3980d3ceaeec95e5fa7e8382155fdd35df9 Mon Sep 17 00:00:00 2001 From: kououken Date: Fri, 8 Mar 2019 13:01:42 -0800 Subject: [PATCH 3/4] Fixed bug where title was misplaced in subject line. --- back/backend/views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/back/backend/views.py b/back/backend/views.py index 28fdf16..7a2739a 100644 --- a/back/backend/views.py +++ b/back/backend/views.py @@ -414,7 +414,7 @@ def send_report_to_admin(request, report_pk, status): message = None if params['reference_number'] == '': message = EmailMultiAlternatives( - "[Reimbursinator {}] ({})".format(params['title'], status), + "[Reimbursinator] {} ({})".format(params['title'], status), msg_plain, from_email, [to_email], From a67b61cce8e08f474c121a4ef9360a7b65ae9331 Mon Sep 17 00:00:00 2001 From: Daniel Dupriest Date: Fri, 8 Mar 2019 15:43:39 -0800 Subject: [PATCH 4/4] Remove .env file altogether! --- back/.env | 4 ---- 1 file changed, 4 deletions(-) delete mode 100644 back/.env diff --git a/back/.env b/back/.env deleted file mode 100644 index be096b6..0000000 --- a/back/.env +++ /dev/null @@ -1,4 +0,0 @@ -EMAIL_HOST_USER=reimbursinator@gmail.com -EMAIL_HOST_PASSWORD=Frank12345 -SUBMIT_REPORT_DESTINATION_EMAIL=kououken@gmail.com -SUBMIT_REPORT_FROM_EMAIL=from-address@yourmail.com