add stdout log
This commit is contained in:
parent
01dbf7293c
commit
9ade88d076
1 changed files with 16 additions and 3 deletions
|
@ -49,31 +49,42 @@ class Command(MyBaseCommand):
|
||||||
# Comptes
|
# Comptes
|
||||||
# ---
|
# ---
|
||||||
|
|
||||||
|
self.stdout.write("Création des comptes K-Fêt")
|
||||||
|
|
||||||
gaulois = CofProfile.objects.filter(user__last_name='Gaulois')
|
gaulois = CofProfile.objects.filter(user__last_name='Gaulois')
|
||||||
gaulois_trigramme = map('{:03d}'.format, range(50))
|
gaulois_trigramme = map('{:03d}'.format, range(50))
|
||||||
|
|
||||||
romains = CofProfile.objects.filter(user__last_name='Romain')
|
romains = CofProfile.objects.filter(user__last_name='Romain')
|
||||||
romains_trigramme = map(lambda x: str(100+x), range(99))
|
romains_trigramme = map(lambda x: str(100+x), range(99))
|
||||||
|
|
||||||
|
created_accounts = 0
|
||||||
|
team_accounts = 0
|
||||||
|
|
||||||
for (profile, trigramme) in zip(gaulois, gaulois_trigramme):
|
for (profile, trigramme) in zip(gaulois, gaulois_trigramme):
|
||||||
account, _ = Account.objects.get_or_create(
|
account, created = Account.objects.get_or_create(
|
||||||
trigramme=trigramme,
|
trigramme=trigramme,
|
||||||
cofprofile=profile,
|
cofprofile=profile,
|
||||||
defaults={'balance': random.randint(1, 999)/10}
|
defaults={'balance': random.randint(1, 999)/10}
|
||||||
)
|
)
|
||||||
|
created_accounts += int(created)
|
||||||
|
|
||||||
if profile.user.first_name == 'Abraracourcix':
|
if profile.user.first_name == 'Abraracourcix':
|
||||||
profile.user.groups.add(group_chef)
|
profile.user.groups.add(group_chef)
|
||||||
|
|
||||||
for (profile, trigramme) in zip(romains, romains_trigramme):
|
for (profile, trigramme) in zip(romains, romains_trigramme):
|
||||||
account, _ = Account.objects.get_or_create(
|
account, created = Account.objects.get_or_create(
|
||||||
trigramme=trigramme,
|
trigramme=trigramme,
|
||||||
cofprofile=profile,
|
cofprofile=profile,
|
||||||
defaults={'balance': random.randint(1, 999)/10}
|
defaults={'balance': random.randint(1, 999)/10}
|
||||||
)
|
)
|
||||||
|
created_accounts += int(created)
|
||||||
|
|
||||||
if random.random() > 0.75:
|
if random.random() > 0.75 and created:
|
||||||
profile.user.groups.add(group_boy)
|
profile.user.groups.add(group_boy)
|
||||||
|
team_accounts += 1
|
||||||
|
|
||||||
|
self.stdout.write("- {:d} comptes créés, {:d} dans l'équipe K-Fêt"
|
||||||
|
.format(created_accounts, team_accounts))
|
||||||
|
|
||||||
# Compte liquide
|
# Compte liquide
|
||||||
|
|
||||||
|
@ -97,6 +108,8 @@ class Command(MyBaseCommand):
|
||||||
# Opérations
|
# Opérations
|
||||||
# ---
|
# ---
|
||||||
|
|
||||||
|
self.stdout.write("Génération d'opérations")
|
||||||
|
|
||||||
articles = Article.objects.all()
|
articles = Article.objects.all()
|
||||||
accounts = Account.objects.exclude(trigramme='LIQ')
|
accounts = Account.objects.exclude(trigramme='LIQ')
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue