1
0
mirror of https://gitlab.crans.org/bde/nk20-scripts synced 2024-12-25 00:42:23 +00:00

I broke the import script

This commit is contained in:
Yohann D'ANELLO 2020-09-05 00:33:38 +02:00
parent 525f091b0c
commit 2a113d22b9

View File

@ -94,7 +94,7 @@ class Command(ImportCommand):
# clean pseudo (normalized pseudo must be unique and not empty)
if not pseudo_norm or pseudo_norm in ALIAS_SET:
pseudo = pseudo + str(row["idbde"])
CHANGED_USERNAMES.append((pk_note, row[pseudo], pseudo))
CHANGED_USERNAMES.append((pk_note, row["idbde"], pseudo))
else:
ALIAS_SET.add(pseudo_norm)
# clean date
@ -138,7 +138,7 @@ class Command(ImportCommand):
"registration_valid": True,
"email_confirmed": True,
"promotion": MAP_IDBDE_PROMOTION[row["idbde"]]["promo"],
"report_frequency": row["report_period"],
"report_frequency": max(row["report_period"], 0),
"last_report": make_aware(row["previous_report_date"]),
}
note_dict["created_at"] = make_aware(MAP_IDBDE_PROMOTION[row["idbde"]]["created_at"])
@ -248,7 +248,7 @@ class Command(ImportCommand):
json.dump(MAP_IDBDE, fp, sort_keys=True, indent=2)
for pk_user, old_username, new_username in CHANGED_USERNAMES:
user = User.objects.get(pk_user)
user = User.objects.get(pk=pk_user)
mail_text = render_to_string("scripts/unsupported_username.txt", dict(
user=user,
old_username=old_username,
@ -257,7 +257,7 @@ class Command(ImportCommand):
user.email_user("Transition à la Note Kfet 2020 : pseudo non supporté", mail_text)
for pk_user, aliases_list in CHANGED_USERNAMES:
user = User.objects.get(pk_user)
user = User.objects.get(pk=pk_user)
mail_text = render_to_string("scripts/deleted_aliases.txt", dict(
user=user,
aliases_list=aliases_list,