Feat: table des évaluations

This commit is contained in:
Bertrand Benjamin 2021-02-23 17:55:43 +01:00
parent 3dbfc85447
commit 581b0f4f2f
1 changed files with 29 additions and 7 deletions

View File

@ -97,10 +97,30 @@ layout = html.Div(
children=[ children=[
html.H2("Évaluations"), html.H2("Évaluations"),
html.Div( html.Div(
id="describe", dash_table.DataTable(
id="exam_scores",
columns=[
{"id": "Nom", "name": "Évaluations"},
{"id": "Note", "name": "Note"},
{"id": "Bareme", "name": "Barème"},
],
data=[],
style_data_conditional=[
{
"if": {"row_index": "odd"},
"backgroundColor": "rgb(248, 248, 248)",
}
],
style_data={
"width": "100px",
"maxWidth": "100px",
"minWidth": "100px",
},
),
id="eval-table",
), ),
html.Div( html.Div(
id="eval-table", id="describe",
), ),
], ],
id="Évaluations", id="Évaluations",
@ -119,7 +139,6 @@ layout = html.Div(
] ]
), ),
dcc.Store(id="student-scores"), dcc.Store(id="student-scores"),
html.P(id="test"),
] ]
) )
@ -183,13 +202,16 @@ def update_student_scores(tribe, student, term):
@app.callback( @app.callback(
[ [
dash.dependencies.Output("test", "children"), dash.dependencies.Output("exam_scores", "data"),
], ],
[ [
dash.dependencies.Input("student-scores", "data"), dash.dependencies.Input("student-scores", "data"),
], ],
) )
def update_test(data): def update_exam_scores(data):
return [str(data)] scores = pd.DataFrame.from_records(data)
scores = pp_q_scores(scores)
assessment_scores = scores.groupby(["Nom"]).agg({"Note": "sum", "Bareme": "sum"})
return [assessment_scores.reset_index().to_dict("records")]
return [{}]