Feat: Start feedback on eval
This commit is contained in:
parent
d322452a6e
commit
ff94470fb4
@ -5,6 +5,7 @@ import dash
|
|||||||
import dash_html_components as html
|
import dash_html_components as html
|
||||||
import dash_core_components as dcc
|
import dash_core_components as dcc
|
||||||
import dash_table
|
import dash_table
|
||||||
|
import plotly.graph_objects as go
|
||||||
from datetime import date, datetime
|
from datetime import date, datetime
|
||||||
import uuid
|
import uuid
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
@ -141,7 +142,7 @@ layout = html.Div(
|
|||||||
id="competences-viz",
|
id="competences-viz",
|
||||||
),
|
),
|
||||||
html.Div(
|
html.Div(
|
||||||
id="domains-viz",
|
id="themes-viz",
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
id="visualisation",
|
id="visualisation",
|
||||||
@ -316,6 +317,31 @@ def score_rate(data):
|
|||||||
return [html.P(f"Barème /{exam.score_rate}")]
|
return [html.P(f"Barème /{exam.score_rate}")]
|
||||||
|
|
||||||
|
|
||||||
|
@app.callback(
|
||||||
|
dash.dependencies.Output("competences-viz", "figure"),
|
||||||
|
dash.dependencies.Input("exam_store", "data"),
|
||||||
|
prevent_initial_call=True,
|
||||||
|
)
|
||||||
|
def competences_viz(data):
|
||||||
|
exam = Exam(**data)
|
||||||
|
return [html.P(str(exam.competences_rate))]
|
||||||
|
|
||||||
|
|
||||||
|
@app.callback(
|
||||||
|
dash.dependencies.Output("themes-viz", "children"),
|
||||||
|
dash.dependencies.Input("exam_store", "data"),
|
||||||
|
prevent_initial_call=True,
|
||||||
|
)
|
||||||
|
def themes_viz(data):
|
||||||
|
exam = Exam(**data)
|
||||||
|
themes_rate = exam.themes_rate
|
||||||
|
fig = go.Figure()
|
||||||
|
if themes_rate:
|
||||||
|
fig.add_trace(go.Pie(labels=list(themes_rate.keys()), values=list(themes_rate.values())))
|
||||||
|
return [dcc.Graph(figure=fig)]
|
||||||
|
return []
|
||||||
|
|
||||||
|
|
||||||
@app.callback(
|
@app.callback(
|
||||||
dash.dependencies.Output("is-saved", "children"),
|
dash.dependencies.Output("is-saved", "children"),
|
||||||
dash.dependencies.Input("save-csv", "n_clicks"),
|
dash.dependencies.Input("save-csv", "n_clicks"),
|
||||||
|
@ -165,3 +165,38 @@ class Exam:
|
|||||||
total += sum([q["score_rate"] for q in questions])
|
total += sum([q["score_rate"] for q in questions])
|
||||||
|
|
||||||
return total
|
return total
|
||||||
|
|
||||||
|
@property
|
||||||
|
def competences_rate(self):
|
||||||
|
""" Dictionnary with competences as key and total rate as value"""
|
||||||
|
rates = {}
|
||||||
|
for ex, questions in self._exercises.items():
|
||||||
|
for q in questions:
|
||||||
|
try:
|
||||||
|
q["competence"]
|
||||||
|
except KeyError:
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
try:
|
||||||
|
rates[q["competence"]] += q["score_rate"]
|
||||||
|
except KeyError:
|
||||||
|
rates[q["competence"]] = q["score_rate"]
|
||||||
|
return rates
|
||||||
|
|
||||||
|
@property
|
||||||
|
def themes_rate(self):
|
||||||
|
""" Dictionnary with themes as key and total rate as value"""
|
||||||
|
rates = {}
|
||||||
|
for ex, questions in self._exercises.items():
|
||||||
|
for q in questions:
|
||||||
|
try:
|
||||||
|
q["theme"]
|
||||||
|
except KeyError:
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
if q["theme"]:
|
||||||
|
try:
|
||||||
|
rates[q["theme"]] += q["score_rate"]
|
||||||
|
except KeyError:
|
||||||
|
rates[q["theme"]] = q["score_rate"]
|
||||||
|
return rates
|
||||||
|
Loading…
Reference in New Issue
Block a user