Skip to content

Commit

Permalink
fix: fixed non Attribute error when a report hasn't been sent yet
Browse files Browse the repository at this point in the history
  • Loading branch information
Asespinel committed Jan 12, 2024
1 parent e1124b7 commit 7efc777
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lms/templates/admin/base_site.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ <h1 id="site-name"><a href="{% url 'admin:index' %}">{{ site_header|default:_('D

{% block messages %}{{ block.super }}
{% include "survey_report/admin_banner.html" %}
{% endblock %}
{% endblock %}
8 changes: 5 additions & 3 deletions openedx/features/survey_report/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,11 @@ def report_state(self, obj):
Method to define the custom State column with the new "send" state,
to avoid modifying the current models.
"""
if obj.surveyreportupload_set.last().is_uploaded():
return "Sent"
return obj.state.capitalize()
try:
if obj.surveyreportupload_set.last().is_uploaded():
return "Sent"
except AttributeError:
return obj.state.capitalize()
report_state.short_description = 'State'

admin.site.register(SurveyReport, SurveyReportAdmin)

0 comments on commit 7efc777

Please sign in to comment.