Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions hypha/apply/projects/reports/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,9 @@ def has_very_late_reports(self):
def past_due_reports(self):
return self.project.reports.to_do()

def submitted_reports(self):
return self.project.reports.submitted()

def last_report(self):
today = timezone.now().date()
# Get the most recent report that was either:
Expand Down
28 changes: 22 additions & 6 deletions hypha/apply/projects/tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import django_tables2 as tables
from django.utils.safestring import mark_safe
from django.utils.text import slugify
from django.utils.translation import gettext_lazy as _
from django.utils.translation import gettext as _
from django_tables2.utils import A
from heroicons.templatetags.heroicons import heroicon_outline

Expand Down Expand Up @@ -157,16 +157,32 @@ def render_reporting(self, record):
if not hasattr(record, "report_config"):
return "-"

display = []

if record.report_config.is_up_to_date():
return "Up to date"
display.append(_("Up to date"))

if record.report_config.submitted_reports():
display.append(
_("{submitted_reports} submitted").format(
submitted_reports=len(record.report_config.submitted_reports())
)
)

if record.report_config.has_very_late_reports():
display = f"<span class='text-red-500 inline-block align-text-bottom me-1'>{heroicon_outline(name='exclamation-triangle', size=20)}</span>"
very_late = f"<span class='text-red-500 inline-block align-text-bottom ms-1'>{heroicon_outline(name='exclamation-triangle', size=20)}</span>"
else:
display = ""
very_late = ""

if record.report_config.outstanding_reports():
display.append(
_("{outstanding_reports} outstanding{very_late}").format(
very_late=very_late,
outstanding_reports=record.report_config.outstanding_reports(),
)
)

display += f"{record.report_config.outstanding_reports()} outstanding"
return mark_safe(display)
return mark_safe("<br>".join(display))


class ProjectsDashboardTable(BaseProjectsTable):
Expand Down
Loading