diff --git a/bda/management/commands/manage_reventes.py b/bda/management/commands/manage_reventes.py index 5fa3806b..45b9c91a 100644 --- a/bda/management/commands/manage_reventes.py +++ b/bda/management/commands/manage_reventes.py @@ -14,7 +14,6 @@ class Command(BaseCommand): def handle(self, *args, **options): now = timezone.now() - self.stdout.write(now.__str__()) reventes = SpectacleRevente.objects.all() for revente in reventes: # Check si < 24h @@ -22,15 +21,18 @@ class Command(BaseCommand): revente.date + timedelta(days=1)) and \ now >= revente.date + timedelta(minutes=15) and \ not revente.notif_sent: + self.stdout.write(str(now)) revente.mail_shotgun() self.stdout.write("Mail de disponibilité immédiate envoyé") # Check si délai de retrait dépassé elif (now >= revente.date + timedelta(hours=1) and not revente.notif_sent): + self.stdout.write(str(now)) revente.send_notif() self.stdout.write("Mail d'inscription à une revente envoyé") # Check si tirage à faire elif (now >= revente.expiration_time and not revente.tirage_done): + self.stdout.write(str(now)) revente.tirage() self.stdout.write("Tirage effectué, mails envoyés") diff --git a/bda/models.py b/bda/models.py index 1074e58b..085bd548 100644 --- a/bda/models.py +++ b/bda/models.py @@ -269,7 +269,7 @@ class SpectacleRevente(models.Model): for participant in inscrits: mail_body = render_template('mail-revente.txt', { 'user': participant.user, - 'spectacle': self.spectacle, + 'spectacle': self.attribution.spectacle, 'revente': self}) mail_tot = mail.EmailMessage( mail_object, mail_body, @@ -290,7 +290,7 @@ class SpectacleRevente(models.Model): for participant in inscrits: mail_body = render_template('mail-shotgun.txt', { 'user': participant.user, - 'spectacle': self.spectacle, + 'spectacle': self.attribution.spectacle, 'mail': self.attribution.participant.user.email}) mail_tot = mail.EmailMessage( mail_object, mail_body, diff --git a/bda/templates/mail-revente.txt b/bda/templates/mail-revente.txt index adc61eb9..94cab1b1 100644 --- a/bda/templates/mail-revente.txt +++ b/bda/templates/mail-revente.txt @@ -2,7 +2,7 @@ Bonjour {{ user.get_full_name }} Une place pour le spectacle {{ spectacle.title }} ({{spectacle.date_no_seconds}}) a été postée sur BdA-Revente. -Si ce spectacle t'intéresse toujours, merci de nous le signaler en cliquant sur ce lien : {% url "bda-interested-revente" revente.id %}. Dans le cas où plusieurs personnes seraient intéressées, nous procèderons à un tirage au sort le {{revente.date_no_seconds}} +Si ce spectacle t'intéresse toujours, merci de nous le signaler en cliquant sur ce lien : {% url "bda-revente-interested" revente.id %}. Dans le cas où plusieurs personnes seraient intéressées, nous procèderons à un tirage au sort le {{revente.date_no_seconds}} Chaleureusement, Le BdA diff --git a/bda/templates/mail-shotgun.txt b/bda/templates/mail-shotgun.txt index 8c4e7bd9..4f972cf9 100644 --- a/bda/templates/mail-shotgun.txt +++ b/bda/templates/mail-shotgun.txt @@ -2,7 +2,7 @@ Bonjour {{ user.get_full_name }} Une place pour le spectacle {{ spectacle.title }} ({{spectacle.date_no_seconds}}) a été postée sur BdA-Revente. -Puisque ce spectacle a lieu dans moins de 24h, il n'y a pas de tirage au sort pour cette place : elle est disponible immédiatement à l'addresse {{url "bda-buy-revente" spectacle.id}}, à la disposition de tous. +Puisque ce spectacle a lieu dans moins de 24h, il n'y a pas de tirage au sort pour cette place : elle est disponible immédiatement à l'addresse {%url "bda-buy-revente" spectacle.id%}, à la disposition de tous. Chaleureusement, Le BdA