This commit is contained in:
Etienne Loupias 2018-02-28 16:02:11 +01:00
parent 931bf4058a
commit 16f14b10c9
1 changed files with 3 additions and 2 deletions

View File

@ -99,8 +99,9 @@ class grandlyonIodas(BaseResource):
if 'taches' in etape :
for tache in etape['taches']['tache'] :
if tache['idtypetache'] == 2 and datetime.strptime(tache['datearret'], "%d/%m/%Y") > datetime.now():
moisfin = 1 if (datetime.strptime(tache['datearret'], "%d/%m/%Y") - dateutil.relativedelta.relativedelta(months=1)) == datetime.now() else 0
droits.append({"libl":tache['produit']['libl'], "dateproposition":tache['dateproposition'], "datearret":tache['datearret'], "dateeffet":tache['dateeffet'], "moisfin":moisfin})
for nb in [3,6] :
deltafindroit = nb if (datetime.strptime(tache['datearret'], "%d/%m/%Y") - dateutil.relativedelta.relativedelta(months=nb)) == datetime.now().replace(hour=0, minute=0, second=0, microsecond=0) else 0
droits.append({"libl":tache['produit']['libl'], "dateproposition":tache['dateproposition'], "datearret":tache['datearret'], "dateeffet":tache['dateeffet'], "deltafindroit":deltafindroit})
return {'hash': hashlib.sha224(json.dumps(data)).hexdigest(),
'libl': data['procedures']['procedures']['procedure'][nbProc]['libl'] if 'procedures' in data else '',