Feat: Clean empty fig

This commit is contained in:
Bertrand Benjamin 2021-01-15 17:49:30 +01:00
parent 09ac9f01f8
commit a14d47b15c

View File

@ -42,7 +42,7 @@ app.layout = html.Div(
color="success", color="success",
dark=True, dark=True,
), ),
html.Br(), html.H2("Choix de l'évaluation"),
dbc.Row( dbc.Row(
[ [
dbc.Col( dbc.Col(
@ -66,16 +66,16 @@ app.layout = html.Div(
), ),
], ],
), ),
html.Br(), html.H2("Résultats"),
dbc.Row( dbc.Row(
[ [
dbc.Col( dbc.Col(
dash_table.DataTable( dash_table.DataTable(
id="final_score_table", id="final_score_table",
columns=[ columns=[
{"id": "Élève", "name": "Élève"}, {"id": "Eleve", "name": "Élève"},
{"id": "Note", "name": "Note"}, {"id": "Note", "name": "Note"},
{"id": "Barème", "name": "Barème"}, {"id": "Bareme", "name": "Barème"},
], ],
data=[], data=[],
style_data_conditional=[ style_data_conditional=[
@ -118,8 +118,8 @@ app.layout = html.Div(
), ),
], ],
), ),
html.Br(), html.H2("Édition des notes"),
html.Div( dbc.Row(
[ [
dash_table.DataTable( dash_table.DataTable(
id="scores_table", id="scores_table",
@ -134,6 +134,7 @@ app.layout = html.Div(
dbc.Button("Ajouter un élément", id="btn_add_element"), dbc.Button("Ajouter un élément", id="btn_add_element"),
] ]
), ),
html.H2("Actions"),
dcc.Store(id="final_score"), dcc.Store(id="final_score"),
] ]
) )
@ -219,7 +220,7 @@ def update_final_scores_hist(data):
assessment_scores = pd.DataFrame.from_records(data) assessment_scores = pd.DataFrame.from_records(data)
if assessment_scores.empty: if assessment_scores.empty:
return [{}] return [{'data': [], 'layout':[]}]
ranges = np.linspace( ranges = np.linspace(
0, assessment_scores.Bareme.max(), int(assessment_scores.Bareme.max() * 2 + 1) 0, assessment_scores.Bareme.max(), int(assessment_scores.Bareme.max() * 2 + 1)
@ -264,7 +265,7 @@ def update_competence_fig(data):
scores = flat_df_students(scores).dropna(subset=["Score"]) scores = flat_df_students(scores).dropna(subset=["Score"])
if scores.empty: if scores.empty:
return [{}] return [{'data': [], 'layout':[]}]
scores = pp_q_scores(scores) scores = pp_q_scores(scores)
pt = pd.pivot_table( pt = pd.pivot_table(