Feat: écriture du fichier csv
This commit is contained in:
parent
1886deb430
commit
77c358b0c1
@ -1,4 +1,4 @@
|
|||||||
nom,email
|
Nom,email
|
||||||
Star Tice,stice0@jalbum.net
|
Star Tice,stice0@jalbum.net
|
||||||
Umberto Dingate,udingate1@tumblr.com
|
Umberto Dingate,udingate1@tumblr.com
|
||||||
Starlin Crangle,scrangle2@wufoo.com
|
Starlin Crangle,scrangle2@wufoo.com
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
nom,email
|
Nom,email
|
||||||
Elle McKintosh,emckintosh0@1und1.de
|
Elle McKintosh,emckintosh0@1und1.de
|
||||||
Ty Megany,tmegany1@reuters.com
|
Ty Megany,tmegany1@reuters.com
|
||||||
Pippa Borrows,pborrows2@a8.net
|
Pippa Borrows,pborrows2@a8.net
|
||||||
|
|
@ -5,10 +5,12 @@ import click
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
import sys
|
import sys
|
||||||
import papermill as pm
|
import papermill as pm
|
||||||
|
import pandas as pd
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
from .getconfig import config
|
from .getconfig import config
|
||||||
from .prompts import prompt_exam, prompt_exercise
|
from .prompts import prompt_exam, prompt_exercise
|
||||||
|
from ..config import NO_ST_COLUMNS
|
||||||
|
|
||||||
|
|
||||||
@click.group()
|
@click.group()
|
||||||
@ -42,7 +44,8 @@ def exam_dict2element(exam):
|
|||||||
"term": exam["term"],
|
"term": exam["term"],
|
||||||
"assessment": exam["name"],
|
"assessment": exam["name"],
|
||||||
"date": exam["date"].strftime("%d/%m/%Y"),
|
"date": exam["date"].strftime("%d/%m/%Y"),
|
||||||
"exercice": ex["name"],
|
"exercise": ex["name"],
|
||||||
|
"question": q["id"],
|
||||||
**q,
|
**q,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
@ -56,7 +59,23 @@ def new_exam():
|
|||||||
exam["exercices"] = []
|
exam["exercices"] = []
|
||||||
for ex in range(int(exam["ExQty"])):
|
for ex in range(int(exam["ExQty"])):
|
||||||
exam["exercices"].append(prompt_exercise(ex + 1))
|
exam["exercices"].append(prompt_exercise(ex + 1))
|
||||||
print(exam_dict2element(exam))
|
|
||||||
|
elements = exam_dict2element(exam)
|
||||||
|
|
||||||
|
base_df = pd.DataFrame.from_dict(elements)[NO_ST_COLUMNS.keys()]
|
||||||
|
base_df.rename(columns=NO_ST_COLUMNS, inplace=True)
|
||||||
|
|
||||||
|
students = pd.read_csv(exam["tribe"]["students"])["Nom"]
|
||||||
|
for student in students:
|
||||||
|
base_df[student] = ""
|
||||||
|
|
||||||
|
dest = (
|
||||||
|
Path(config["source"])
|
||||||
|
/ exam["tribe"]["name"]
|
||||||
|
/ f"{exam['date'].strftime('%y%m%d')}_{exam['name']}.csv"
|
||||||
|
)
|
||||||
|
base_df.to_csv(dest, index=False)
|
||||||
|
print(f"Le fichier note a été enregistré à {dest}")
|
||||||
|
|
||||||
|
|
||||||
@cli.command()
|
@cli.command()
|
||||||
|
Loading…
Reference in New Issue
Block a user