Commit 447142f5 by Tangui

Permet l'envoi des alertes pour une étape donnée

parent fdec0e19
......@@ -24,7 +24,8 @@ from .tools.mails import (envoyer_emails as envoyer_emails_,
extraire_mails_cada as extraire_mails_cada_)
from .tools.procedure import (fix_procedure as fix_procedure_,
avance_procedure as avance_procedure_,
export_pour_ta as export_pour_ta_)
export_pour_ta as export_pour_ta_,
send_alerte as send_alerte_)
from .tools.text import hash_password
......@@ -109,6 +110,16 @@ def avance_procedure(etape):
@manager.command
@manager.option('-e', '--etape', dest='etape', default=None)
def send_alerte(etape):
"""
Envoi les alertes pour une étape données
"""
app.config.update(SQLALCHEMY_ECHO=False)
send_alerte_(app, int(etape))
@manager.command
def erratum_cada():
"""
Envoi les e-mails d'erratum CADA
......
......@@ -265,7 +265,7 @@ ETAPES = [
'couleur': '#eebb44',
'icone': 'balance-scale',
'hidden': False,
'alerte': False
'alerte': True
},
{
'ordre': ETAPE_ATTENTE_CE,
......@@ -282,7 +282,7 @@ ETAPES = [
'couleur': '#bbbbbb',
'icone': 'balance-scale',
'hidden': False,
'alerte': False
'alerte': True
}
]
......
......@@ -45,6 +45,21 @@ def fix_procedure(app):
db.session.commit()
def send_alerte(app, ordre_etape):
etape = ETAPES_BY_ORDRE.get(ordre_etape, None)
parls = Parlementaire.query \
.filter(Parlementaire.etape == ordre_etape) \
.order_by(Parlementaire.nom) \
.all()
for parl in parls:
print(parl.nom_complet)
if etape['alerte'] and not app.config['MAIL_SUPPRESS_SEND']:
cnt = envoyer_alerte(app, etape, parl)
if cnt:
print('%s e-mails d\'alerte envoyés' % cnt)
sleep(1)
def avance_procedure(app, ordre_etape):
etape = ETAPES_BY_ORDRE.get(ordre_etape, None)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment