Feat: add get_exam_scores to loader

This commit is contained in:
Bertrand Benjamin 2021-04-18 10:48:12 +02:00
parent a50901556e
commit 0739cfdae7

View File

@ -214,6 +214,25 @@ class CSVLoader(Loader):
return pd.concat(scores) return pd.concat(scores)
def get_exam_scores(self, exams=[]):
""" Get scores for all question of the exam
:param exams: list or dataframe of exams metadatas (need origin field to find the csv)
:example:
>>> loader = CSVLoader("./test_config.yml")
>>> exams = loader.get_exams(["Tribe1"])
>>> scores = loader.get_exam_scores(exams)
>>> scores.columns
Index(['term', 'exam', 'date', 'exercise', 'question', 'competence', 'theme',
'comment', 'score_rate', 'is_leveled', 'origin', 'exam_id',
'question_id', 'student_name', 'score'],
dtype='object')
"""
questions = self.get_exam_questions(exams)
return self.get_questions_scores(questions)
def get_students(self, tribes=[]): def get_students(self, tribes=[]):
"""Get student list """Get student list