Fix: column order in score table

This commit is contained in:
Bertrand Benjamin 2021-11-22 16:33:59 +01:00
parent 29f67cfa0c
commit 58647a734c

View File

@ -365,6 +365,11 @@ def highlight_value(df):
] ]
return hight return hight
def scores_table_column_order(df):
df_student_columns = [c for c in df.columns if c not in NO_ST_COLUMNS.values()]
order = list(NO_ST_COLUMNS.values())+df_student_columns
return df.loc[:, order]
@app.callback( @app.callback(
[ [
@ -388,6 +393,7 @@ def update_scores_table(csv, add_element, data):
[{k: stack.iloc[-1][k] for k in NO_ST_COLUMNS.values()}] [{k: stack.iloc[-1][k] for k in NO_ST_COLUMNS.values()}]
) )
stack = stack.append(infos) stack = stack.append(infos)
stack = scores_table_column_order(stack)
return ( return (
[ [
{"id": c, "name": c} {"id": c, "name": c}