Compare commits
No commits in common. "98d9fd40264ac33ffaaca3cbe3e2475d91ac5122" and "58647a734cca68e904263f940e2972c3298e7733" have entirely different histories.
98d9fd4026
...
58647a734c
@ -343,7 +343,6 @@ def update_competence_fig(data):
|
|||||||
def save_scores(data, csv):
|
def save_scores(data, csv):
|
||||||
try:
|
try:
|
||||||
scores = pd.DataFrame.from_records(data)
|
scores = pd.DataFrame.from_records(data)
|
||||||
scores = scores_table_column_order(scores)
|
|
||||||
scores.to_csv(csv, index=False)
|
scores.to_csv(csv, index=False)
|
||||||
except:
|
except:
|
||||||
return [f"Soucis pour sauvegarder à {datetime.today()} dans {csv}"]
|
return [f"Soucis pour sauvegarder à {datetime.today()} dans {csv}"]
|
||||||
|
@ -10,6 +10,7 @@ from datetime import datetime
|
|||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
from .getconfig import config, CONFIGPATH
|
from .getconfig import config, CONFIGPATH
|
||||||
|
from .prompts import prompt_exam, prompt_exercise, prompt_validate
|
||||||
from ..config import NO_ST_COLUMNS
|
from ..config import NO_ST_COLUMNS
|
||||||
from .exam import Exam
|
from .exam import Exam
|
||||||
from ..dashboard.index import app as dash
|
from ..dashboard.index import app as dash
|
||||||
@ -36,6 +37,55 @@ def setup():
|
|||||||
print(f"The file {tribe['students']} does not exists")
|
print(f"The file {tribe['students']} does not exists")
|
||||||
|
|
||||||
|
|
||||||
|
@cli.command()
|
||||||
|
def new_exam():
|
||||||
|
"""Create new exam csv file"""
|
||||||
|
exam = Exam(**prompt_exam())
|
||||||
|
|
||||||
|
if exam.path(".yml").exists():
|
||||||
|
print(f"Fichier sauvegarde trouvé à {exam.path('.yml')} -- importation")
|
||||||
|
with open(exam.path(".yml"), "r") as f:
|
||||||
|
for name, questions in yaml.load(f, Loader=yaml.SafeLoader)[
|
||||||
|
"exercices"
|
||||||
|
].items():
|
||||||
|
exam.add_exercise(name, questions)
|
||||||
|
|
||||||
|
print(exam.themes)
|
||||||
|
# print(yaml.dump(exam.to_dict()))
|
||||||
|
|
||||||
|
exam.write()
|
||||||
|
|
||||||
|
for name, questions in exam.exercices.items():
|
||||||
|
exam.modify_exercise(
|
||||||
|
**prompt_exercise(
|
||||||
|
name=name, completer={"theme": exam.themes}, questions=questions
|
||||||
|
)
|
||||||
|
)
|
||||||
|
exam.write()
|
||||||
|
|
||||||
|
new_exercise = prompt_validate("Ajouter un exercice? ")
|
||||||
|
while new_exercise:
|
||||||
|
exam.add_exercise(
|
||||||
|
**prompt_exercise(len(exam.exercices) + 1, completer={"theme": exam.themes})
|
||||||
|
)
|
||||||
|
exam.write()
|
||||||
|
new_exercise = prompt_validate("Ajouter un exercice? ")
|
||||||
|
|
||||||
|
rows = exam.to_row()
|
||||||
|
|
||||||
|
base_df = pd.DataFrame.from_dict(rows)[NO_ST_COLUMNS.keys()]
|
||||||
|
base_df.rename(columns=NO_ST_COLUMNS, inplace=True)
|
||||||
|
|
||||||
|
students = pd.read_csv(exam.tribe_student_path)["Nom"]
|
||||||
|
for student in students:
|
||||||
|
base_df[student] = ""
|
||||||
|
|
||||||
|
exam.tribe_path.mkdir(exist_ok=True)
|
||||||
|
|
||||||
|
base_df.to_csv(exam.path(".csv"), index=False)
|
||||||
|
print(f"Le fichier note a été enregistré à {exam.path('.csv')}")
|
||||||
|
|
||||||
|
|
||||||
@cli.command()
|
@cli.command()
|
||||||
@click.option("--debug", default=0, help="Debug mode for dash")
|
@click.option("--debug", default=0, help="Debug mode for dash")
|
||||||
def dashboard(debug):
|
def dashboard(debug):
|
||||||
|
Loading…
Reference in New Issue
Block a user