fix manage_reventes

This commit is contained in:
Ludovic Stephan 2016-10-03 16:47:22 +02:00
parent 018f493b16
commit 7fbf0e4809
4 changed files with 7 additions and 5 deletions

View file

@ -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")