Simplify name multiplicy ckeck in Student
This commit is contained in:
parent
59cd8e2aba
commit
d0bc842a2a
|
@ -25,17 +25,16 @@ class Student(object):
|
|||
Description of a student from quest, exo and eval
|
||||
|
||||
"""
|
||||
if len(quest_df["Eleve"].unique()) != 1:
|
||||
raise ValueError("Can't initiate Student: quest_df contains different student names")
|
||||
elif len(exo_df["Eleve"].unique()) != 1:
|
||||
raise ValueError("Can't initiate Student: exo_df contains different student names")
|
||||
elif len(eval_df["Eleve"].unique()) != 1:
|
||||
raise ValueError("Can't initiate Student: eval_df contains different student names")
|
||||
elif quest_df["Eleve"].iloc[0] != exo_df["Eleve"].iloc[0] or \
|
||||
quest_df["Eleve"].iloc[0] != eval_df["Eleve"].iloc[0]:
|
||||
|
||||
name = {*quest_df["Eleve"].unique(),
|
||||
*exo_df["Eleve"].unique(),
|
||||
*eval_df["Eleve"].unique(),
|
||||
}
|
||||
|
||||
if len(name) != 1:
|
||||
raise ValueError("Can't initiate Student: dfs contains different student names")
|
||||
|
||||
self.name = quest_df["Eleve"].iloc[0]
|
||||
self.name = name.pop()
|
||||
|
||||
self.quest_df = quest_df
|
||||
self.exo_df = exo_df
|
||||
|
@ -47,8 +46,9 @@ class Student(object):
|
|||
try:
|
||||
self._marks_tabular
|
||||
except AttributeError:
|
||||
self._marks_tabular = self.eval_df[["Nom", "Mark_barem"]].to_latex()
|
||||
return self._marks_tabular
|
||||
self._marks_tabular = self.eval_df[["Nom", "Mark_barem"]]
|
||||
self._marks_tabular.columns = ["Devoir", "Note"]
|
||||
return self._marks_tabular.to_latex()
|
||||
|
||||
@property
|
||||
def pies_on_competence(self):
|
||||
|
|
Loading…
Reference in New Issue