Commit b358c89d by Nicolas Joyard

Reunions 14e + resto ancien job si 0 maj

parent e431586f
......@@ -45,7 +45,7 @@ for objtype in $*; do
jsonpath=.export${jsonpath}.dossierParlementaire
;;
texte|scrutin)
texte|scrutin|reunion)
;;
*)
......
......@@ -33,9 +33,9 @@ register_job('an_scrutins15', 'AN: scrutins XVème',
url='/travaux-parlementaires/votes',
objtypes=['scrutin'])
# register_job('an_reunions14', 'AN: réunions XIVème',
# url='/opendata-archives-xive/agendas-xive-legislature',
# objtypes=['reunion'])
register_job('an_reunions14', 'AN: réunions XIVème',
url='/opendata-archives-xive/agendas-xive-legislature',
objtypes=['reunion'])
register_job('an_reunions15', 'AN: réunions XVème',
url='/reunions/reunions',
......
......@@ -84,6 +84,12 @@ class ImportJob(object):
job = Job.query.filter_by(jobid=self.id).first()
if not job:
job = Job(jobid=self.id, nom=self.job_name)
self._prev_job = None
else:
self._prev_job = {
'date_exec': job.date_exec,
'resultat': job.resultat
}
job.date_exec = datetime.now()
......@@ -103,13 +109,22 @@ class ImportJob(object):
def finish_update(self, source, date, count):
job = self.job
job.url_fichier = source
job.date_fichier = date
job.resultat = 'ok'
job.temps_exec = (datetime.now() - self.started_at).total_seconds()
job.nb_items = count
if count:
job.url_fichier = source
job.date_fichier = date
job.resultat = 'ok'
job.temps_exec = (datetime.now() - self.started_at).total_seconds()
job.nb_items = count
db.session.add(job)
else:
# Keep prev status when we did not do anything
if self._prev_job is None:
db.session.remove(job)
else:
job.date_exec = self._prev_job['date_exec']
job.resultat = self._prev_job['resultat']
db.session.add(job)
db.session.add(job)
db.session.commit()
def set_status(self, status):
......
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