Skip to content

Commit

Permalink
simplify maxima/totals
Browse files Browse the repository at this point in the history
  • Loading branch information
boogheta committed Aug 30, 2018
1 parent d6b9362 commit 2cfeb01
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions tlfp/generate_dossiers_csv.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,20 +81,23 @@
if dos.get('url_jo'):
total_promulgues += 1

total_encours = total_doslegs - total_promulgues

erreurs = len(glob.glob(os.path.join(API_DIRECTORY, 'logs/*')))
erreurs_encours = len(glob.glob(os.path.join(API_DIRECTORY, 'logs-encours/*')))

total_encours = total_doslegs - total_promulgues
maximum = total_promulgues + erreurs # assume qu'aucun en cours n'echoue
max_promulgues = total_promulgues + erreurs
max_encours = total_encours + erreurs_encours
maximum = max_promulgues + max_encours

print(total_doslegs, 'doslegs in csv')
print('%.1f%s (%d/%d)' % (100*total_promulgues/(total_promulgues + erreurs), '%', total_promulgues, total_promulgues + erreurs), 'de promulgués qui passent')
print('%.1f%s (%d/%d)' % (100*total_encours/(total_encours + erreurs_encours), '%', total_encours, total_encours + erreurs_encours), 'de textes en cours qui passent')
print('%.1f%s (%d/%d)' % (100*total_promulgues/max_promulgues, '%', total_promulgues, max_promulgues), 'de promulgués qui passent')
print('%.1f%s (%d/%d)' % (100*total_encours/max_encours, '%', total_encours, max_encours), 'de textes en cours qui passent')

home_json_final = {
"total": total_promulgues,
"encours": total_encours,
"maximum": total_promulgues + erreurs
"maximum": max_promulgues,
}
home_json_data.sort(key=lambda x: -x['total_amendements'])
home_json_final["focus"] = {
Expand Down

3 comments on commit 2cfeb01

@mdamien
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

C'est cool, le seul truc dommage c'est que c'est dans la PR en cours: https://github.com/regardscitoyens/the-law-factory-parser/pull/86/files

@boogheta
Copy link
Contributor Author

@boogheta boogheta commented on 2cfeb01 Aug 31, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Je ne comprends pas ce que tu veux dire ? Ce commit est ajouté à la PR

@mdamien
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My bad, j'avais pas vu c'était dans la PR, je croyais que c'était sur master

Please sign in to comment.