Compare commits

...

4 Commits

3 changed files with 62 additions and 6 deletions

View File

@ -19,6 +19,8 @@ main {
margin: auto; margin: auto;
} }
/* Exam analysis */
#select { #select {
margin-bottom: 20px; margin-bottom: 20px;
} }
@ -39,3 +41,20 @@ main {
width: 45vw; width: 45vw;
margin: auto; margin: auto;
} }
/* Create new exam */
#new-exam {
display: flex;
flex-flow: row;
justify-content: space-between;
}
#new-exam label {
width: 20%;
display: flex;
flex-flow: column;
justify-content: space-between;
}

View File

@ -135,7 +135,19 @@ def add_exercise(n_clicks, children):
if n_clicks is None: if n_clicks is None:
return children return children
element_table = pd.DataFrame(columns=[c["id"] for c in QUESTION_COLUMNS]) element_table = pd.DataFrame(columns=[c["id"] for c in QUESTION_COLUMNS])
element_table = element_table.append(pd.Series(name=0)) element_table = element_table.append(
pd.Series(
data={
"id": 1,
"competence": "Rechercher",
"theme": "",
"comment": "",
"score_rate": 1,
"is_leveled": 1,
},
name=0,
)
)
new_exercise = html.Div( new_exercise = html.Div(
children=[ children=[
html.Div( html.Div(
@ -162,7 +174,7 @@ def add_exercise(n_clicks, children):
editable=True, editable=True,
row_deletable=True, row_deletable=True,
dropdown={ dropdown={
"Competence": { "competence": {
"options": [ "options": [
{"label": i, "value": i} for i in config["competences"] {"label": i, "value": i} for i in config["competences"]
] ]
@ -205,7 +217,19 @@ def add_element(n_clicks, elements):
return elements return elements
df = pd.DataFrame.from_records(elements) df = pd.DataFrame.from_records(elements)
df = df.append(pd.Series(name=n_clicks)) df = df.append(
pd.Series(
data={
"id": len(df) + 1,
"competence": "",
"theme": "",
"comment": "",
"score_rate": 1,
"is_leveled": 1,
},
name=n_clicks,
)
)
return df.to_dict("records") return df.to_dict("records")
@ -252,7 +276,6 @@ def store_exam(tribe, exam_name, date, term, exercices, elements, elements_id):
ex_elements = elements[index] ex_elements = elements[index]
exam.add_exercise(name, ex_elements) exam.add_exercise(name, ex_elements)
print(yaml.dump(exam.to_dict()))
return exam.to_dict() return exam.to_dict()

View File

@ -127,12 +127,22 @@ layout = html.Div(
dash_table.DataTable( dash_table.DataTable(
id="scores_table", id="scores_table",
columns=[ columns=[
{"id": c, "name": c} for c in NO_ST_COLUMNS.values() {"id": "id", "name": "Question"},
{
"id": "competence",
"name": "Competence",
},
{"id": "theme", "name": "Domaine"},
{"id": "comment", "name": "Commentaire"},
{"id": "score_rate", "name": "Bareme"},
{"id": "is_leveled", "name": "Est_nivele"},
], ],
style_cell={ style_cell={
"whiteSpace": "normal", "whiteSpace": "normal",
"height": "auto", "height": "auto",
}, },
fixed_columns={"headers": True, "data": 7},
style_table={"minWidth": "100%"},
style_data_conditional=[], style_data_conditional=[],
editable=True, editable=True,
), ),
@ -379,7 +389,11 @@ def update_scores_table(csv, add_element, data):
) )
stack = stack.append(infos) stack = stack.append(infos)
return ( return (
[{"id": c, "name": c} for c in stack.columns], [
{"id": c, "name": c}
for c in stack.columns
if c not in ["Trimestre", "Nom", "Date"]
],
stack.to_dict("records"), stack.to_dict("records"),
highlight_value(stack), highlight_value(stack),
) )