1
0
mirror of https://gitlab.crans.org/bde/nk20 synced 2025-06-21 01:48:21 +02:00

[WEI] Display status bar with tqdm

Signed-off-by: Yohann D'ANELLO <ynerant@crans.org>
This commit is contained in:
2021-09-16 20:46:34 +02:00
parent e89383e3f4
commit 1ef25924a0
2 changed files with 39 additions and 7 deletions

View File

@ -24,7 +24,14 @@ class Command(BaseCommand):
sid = transaction.savepoint()
algorithm = CurrentSurvey.get_algorithm_class()()
algorithm.run_algorithm()
try:
from tqdm import tqdm
display_tqdm = True
except ImportError:
display_tqdm = False
algorithm.run_algorithm(display_tqdm=display_tqdm)
output = options['output']
registrations = algorithm.get_registrations()
@ -34,8 +41,13 @@ class Command(BaseCommand):
for bus, members in per_bus.items():
output.write(bus.name + "\n")
output.write("=" * len(bus.name) + "\n")
order = -1
for r in members:
output.write(r.user.username + "\n")
survey = CurrentSurvey(r)
for order, (b, _score) in enumerate(survey.ordered_buses()):
if b == bus:
break
output.write(f"{r.user.username} ({order + 1})\n")
output.write("\n")
if not options['doit']: