Feat: remove exQty in prompt

This commit is contained in:
Bertrand Benjamin 2021-01-06 08:53:06 +01:00
parent a5f22fc8cd
commit 56a669b2be
2 changed files with 8 additions and 8 deletions

View File

@ -128,11 +128,6 @@ def prompt_exam(**kwrd):
validator=Validator.from_callable(lambda x: x.isdigit()), validator=Validator.from_callable(lambda x: x.isdigit()),
default=kwrd.get("term", "1"), default=kwrd.get("term", "1"),
) )
exam["ExQty"] = prompt(
"Nombre d'exercices: ",
validator=Validator.from_callable(lambda x: x.isdigit()),
default=kwrd.get("ExQty", "1"),
)
return exam return exam

View File

@ -7,9 +7,10 @@ import sys
import papermill as pm import papermill as pm
import pandas as pd import pandas as pd
from datetime import datetime from datetime import datetime
import yaml
from .getconfig import config, CONFIGPATH from .getconfig import config, CONFIGPATH
from .prompts import prompt_exam, prompt_exercise from .prompts import prompt_exam, prompt_exercise, prompt_validate
from ..config import NO_ST_COLUMNS from ..config import NO_ST_COLUMNS
@ -57,8 +58,12 @@ def new_exam():
""" Create new exam csv file """ """ Create new exam csv file """
exam = prompt_exam() exam = prompt_exam()
exam["exercices"] = [] exam["exercices"] = []
for ex in range(int(exam["ExQty"])): new_exercise = prompt_validate("Ajouter un exercice? ")
exam["exercices"].append(prompt_exercise(ex + 1)) while new_exercise:
exam["exercices"].append(prompt_exercise(len(exam["exercices"])+1))
new_exercise = prompt_validate("Ajouter un exercice? ")
print(yaml.dump(exam))
rows = exam_dict2row(exam) rows = exam_dict2row(exam)