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",
dark=True,
),
html.Br(),
html.H2("Choix de l'évaluation"),
dbc.Row(
[
dbc.Col(
@ -66,16 +66,16 @@ app.layout = html.Div(
),
],
),
html.Br(),
html.H2("Résultats"),
dbc.Row(
[
dbc.Col(
dash_table.DataTable(
id="final_score_table",
columns=[
{"id": "Élève", "name": "Élève"},
{"id": "Eleve", "name": "Élève"},
{"id": "Note", "name": "Note"},
{"id": "Barème", "name": "Barème"},
{"id": "Bareme", "name": "Barème"},
],
data=[],
style_data_conditional=[
@ -118,8 +118,8 @@ app.layout = html.Div(
),
],
),
html.Br(),
html.Div(
html.H2("Édition des notes"),
dbc.Row(
[
dash_table.DataTable(
id="scores_table",
@ -134,6 +134,7 @@ app.layout = html.Div(
dbc.Button("Ajouter un élément", id="btn_add_element"),
]
),
html.H2("Actions"),
dcc.Store(id="final_score"),
]
)
@ -219,7 +220,7 @@ def update_final_scores_hist(data):
assessment_scores = pd.DataFrame.from_records(data)
if assessment_scores.empty:
return [{}]
return [{'data': [], 'layout':[]}]
ranges = np.linspace(
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"])
if scores.empty:
return [{}]
return [{'data': [], 'layout':[]}]
scores = pp_q_scores(scores)
pt = pd.pivot_table(