From 566f9ff295901a15d6a395957c43397cff78efcf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-S=C3=A9bastien=20Caux?= <git@jscaux.org> Date: Sat, 28 Jan 2023 18:59:41 +0100 Subject: [PATCH] Add `Contributor.available_again_after_date` property --- .../edadmin/monitor/_hx_college_fellow_activity_table.html | 2 +- scipost_django/scipost/models.py | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/scipost_django/edadmin/templates/edadmin/monitor/_hx_college_fellow_activity_table.html b/scipost_django/edadmin/templates/edadmin/monitor/_hx_college_fellow_activity_table.html index a0c9ac4f3..6f0f00745 100644 --- a/scipost_django/edadmin/templates/edadmin/monitor/_hx_college_fellow_activity_table.html +++ b/scipost_django/edadmin/templates/edadmin/monitor/_hx_college_fellow_activity_table.html @@ -69,7 +69,7 @@ {{ fellowship.contributor.EIC_in_stage_in_refereeing|length }} </td> {% if fellowship.contributor.current_unavailability_periods %} - <td colspan="2"><em class="text-muted">unavailable</em></td> + <td colspan="2" class="text-center"><em class="text-muted">unavailable up to {{ fellowship.contributor.available_again_after_date }}</em></td> {% else %} <td class="text-center">{{ fellowship.nr_visible }}</td> <td class="text-center"> diff --git a/scipost_django/scipost/models.py b/scipost_django/scipost/models.py index f6d259ce5..89ee085ac 100644 --- a/scipost_django/scipost/models.py +++ b/scipost_django/scipost/models.py @@ -161,6 +161,12 @@ class Contributor(models.Model): """Check if Contributor is currently not marked as unavailable.""" return not self.unavailability_periods.today().exists() + @property + def available_again_after_date(self): + unav = self.unavailability_periods.today().first() + if unav: + return unav.end + @property def is_scipost_admin(self): """Check if Contributor is a SciPost Administrator.""" -- GitLab