diff --git a/apps/activity/tables.py b/apps/activity/tables.py index 2d8e5dcc..3320707f 100644 --- a/apps/activity/tables.py +++ b/apps/activity/tables.py @@ -1,6 +1,8 @@ # Copyright (C) 2018-2021 by BDE ENS Paris-Saclay # SPDX-License-Identifier: GPL-3.0-or-later +import datetime + from django.utils import timezone from django.utils.html import escape from django.utils.safestring import mark_safe @@ -75,6 +77,9 @@ def get_row_class(record): c += " table-info" elif record.note.balance < 0: c += " table-danger" + #MODE VIEUXCON=ON + if (datetime.datetime.utcnow().timestamp() - record.note.create_at.timestamp()) > 3600*24*365*3: + c += " font-weight-bold" return c diff --git a/apps/activity/views.py b/apps/activity/views.py index 1f966c65..f677a759 100644 --- a/apps/activity/views.py +++ b/apps/activity/views.py @@ -223,12 +223,13 @@ class ActivityEntryView(LoginRequiredMixin, TemplateView): # Keep only users that have a note note_qs = note_qs.filter(note__noteuser__isnull=False) - # Keep only members - note_qs = note_qs.filter( - note__noteuser__user__memberships__club=activity.attendees_club, - note__noteuser__user__memberships__date_start__lte=timezone.now(), - note__noteuser__user__memberships__date_end__gte=timezone.now(), - ) + if activity.activity_type.name != "Pot Vieux": + # Keep only members + note_qs = note_qs.filter( + note__noteuser__user__memberships__club=activity.attendees_club, + note__noteuser__user__memberships__date_start__lte=timezone.now(), + note__noteuser__user__memberships__date_end__gte=timezone.now(), + ) # Filter with permission backend note_qs = note_qs.filter(PermissionBackend.filter_queryset(self.request, Alias, "view")) diff --git a/note_kfet/static/js/base.js b/note_kfet/static/js/base.js index 4b1b7c78..4335d5fd 100644 --- a/note_kfet/static/js/base.js +++ b/note_kfet/static/js/base.js @@ -96,11 +96,13 @@ function displayStyle (note) { if (!note) { return '' } const balance = note.balance var css = '' + var ms_per_year = 31536000000 // 365 * 24 * 3600 * 1000 if (balance < -5000) { css += ' text-danger bg-dark' } else if (balance < -1000) { css += ' text-danger' } else if (balance < 0) { css += ' text-warning' } if (!note.email_confirmed) { css += ' bg-primary' } else if (!note.is_active || (note.membership && note.membership.date_end < new Date().toISOString())) { css += ' bg-info' } + if (((Date.now() - Date.parse(note.created_at))/ms_per_year) > 3) { css += 'font-weight-bold' } return css }