Feat: write get_exam_questions

This commit is contained in:
Bertrand Benjamin 2021-04-06 18:18:25 +02:00
parent bd91bf51d6
commit 37c95d75de

View File

@ -87,16 +87,44 @@ class CSVLoader(Loader):
def get_students(self, tribes=[]): def get_students(self, tribes=[]):
"""Get student list """Get student list
:param filters: list of filters :param tribes: concerned tribes
""" """
return "" return ""
def get_exam_questions(self, exams=[]): def get_exam_questions(self, score_files=[]):
"""Get questions for the exam """Get questions for exams stored in score_files
:param exams: questions for those exams only :param exams: questions for those exams only
:example:
>>> loader = CSVLoader()
>>> loader.get_exam_questions(["example/Tribe1/210112_DS.csv"])
Exercice Question Competence ... Commentaire Bareme Est_nivele
0 Exercice 1 1 Calculer ... Coucou 1 1
1 Exercice 1 2 Calculer ... Coucou 1 1
2 Exercice 1 3 Calculer ... Coucou 1 1
3 Exercice 1 3 Calculer ... DChic 1 1
<BLANKLINE>
[4 rows x 7 columns]
""" """
return "" questions = []
for score_file in score_files:
fields = self.reverse_csv_field(
[
"exercise",
"question",
"competence",
"theme",
"comment",
"score_rate",
"is_leveled",
]
)
question = extract_fields(score_file, fields)
question = self.rename_columns(question)
questions.append(question)
return pd.concat(questions)
def get_questions_scores(self, questions=[]): def get_questions_scores(self, questions=[]):
"""Get scores of those questions """Get scores of those questions