From 22d668a75ce1b6f484c65a130a617c57406d2633 Mon Sep 17 00:00:00 2001 From: quark Date: Thu, 2 Oct 2025 19:11:26 +0200 Subject: [PATCH] membership date end --- apps/member/models.py | 2 +- apps/note/static/note/js/consos.js | 2 +- apps/note/static/note/js/transfer.js | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/apps/member/models.py b/apps/member/models.py index ea859ea5..e08d4b59 100644 --- a/apps/member/models.py +++ b/apps/member/models.py @@ -417,7 +417,7 @@ class Membership(models.Model): A membership is valid if today is between the start and the end date. """ if self.date_end is not None: - return self.date_start.toordinal() <= datetime.datetime.now().toordinal() < self.date_end.toordinal() + return self.date_start.toordinal() <= datetime.datetime.now().toordinal() <= self.date_end.toordinal() else: return self.date_start.toordinal() <= datetime.datetime.now().toordinal() diff --git a/apps/note/static/note/js/consos.js b/apps/note/static/note/js/consos.js index d08d93bd..99bdf610 100644 --- a/apps/note/static/note/js/consos.js +++ b/apps/note/static/note/js/consos.js @@ -228,7 +228,7 @@ function consume (source, source_alias, dest, quantity, amount, reason, type, ca addMsg(interpolate(gettext('Warning, the transaction from the note %s succeed, ' + 'but the emitter note %s is negative.'), [source_alias, source_alias]), 'warning', 30000) } - if (source.membership && source.membership.date_end < new Date().toISOString()) { + if (source.membership && source.membership.date_end <= new Date().toISOString()) { addMsg(interpolate(gettext('Warning, the emitter note %s is no more a BDE member.'), [source_alias]), 'danger', 30000) } diff --git a/apps/note/static/note/js/transfer.js b/apps/note/static/note/js/transfer.js index ce6ff6ff..1c8797f4 100644 --- a/apps/note/static/note/js/transfer.js +++ b/apps/note/static/note/js/transfer.js @@ -310,10 +310,10 @@ $('#btn_transfer').click(function () { destination: dest.note.id, destination_alias: dest.name }).done(function () { - if (source.note.membership && source.note.membership.date_end < new Date().toISOString()) { + if (source.note.membership && source.note.membership.date_end <= new Date().toISOString()) { addMsg(interpolate(gettext('Warning, the emitter note %s is no more a BDE member.'), [source.name]), 'danger', 30000) } - if (dest.note.membership && dest.note.membership.date_end < new Date().toISOString()) { + if (dest.note.membership && dest.note.membership.date_end <= new Date().toISOString()) { addMsg(interpolate(gettext('Warning, the destination note %s is no more a BDE member.'), [dest.name]), 'danger', 30000) } @@ -414,7 +414,7 @@ $('#btn_transfer').click(function () { bank: $('#bank').val() }).done(function () { addMsg(gettext('Credit/debit succeed!'), 'success', 10000) - if (user_note.membership && user_note.membership.date_end < new Date().toISOString()) { addMsg(gettext('Warning, the emitter note %s is no more a BDE member.'), 'danger', 10000) } + if (user_note.membership && user_note.membership.date_end <= new Date().toISOString()) { addMsg(gettext('Warning, the emitter note %s is no more a BDE member.'), 'danger', 10000) } reset() }).fail(function (err) { const errObj = JSON.parse(err.responseText)