Fix: comportement dans le cas où il n'y a pas encore de séquence

This commit is contained in:
Bertrand Benjamin 2020-10-28 10:29:48 +01:00
parent 951f04dfdf
commit 79acc41dd7

View File

@ -75,8 +75,14 @@ def sequence_prompt(
) )
sequences = get_sequences(sequence["tribe"]) sequences = get_sequences(sequence["tribe"])
print("Séquences trouvées:\n\t" + "\n\t".join(sorted([s.name for s in sequences]))) if sequences:
print("Séquences trouvées:\n\t" +
"\n\t".join(sorted([s.name for s in sequences])))
sequence["num"] = max([int(seq.name[0:2]) for seq in sequences]) + 1 sequence["num"] = max([int(seq.name[0:2]) for seq in sequences]) + 1
else:
print("Pas de séquence trouvée")
sequence["num"] = 1
sequence["title"] = prompt( sequence["title"] = prompt(
f"Nom de la séquence (n°{sequence['num']}): ", default=title f"Nom de la séquence (n°{sequence['num']}): ", default=title
) )
@ -147,4 +153,3 @@ def sequence(c):
sequence["title_under"] = "#" * len(sequence["title"]) sequence["title_under"] = "#" * len(sequence["title"])
import_skel(dest, sequence, "sequence") import_skel(dest, sequence, "sequence")