Feat: default values for elements
This commit is contained in:
parent
1255bf4b9e
commit
429fed6a1e
@ -135,7 +135,19 @@ def add_exercise(n_clicks, children):
|
|||||||
if n_clicks is None:
|
if n_clicks is None:
|
||||||
return children
|
return children
|
||||||
element_table = pd.DataFrame(columns=[c["id"] for c in QUESTION_COLUMNS])
|
element_table = pd.DataFrame(columns=[c["id"] for c in QUESTION_COLUMNS])
|
||||||
element_table = element_table.append(pd.Series(name=0))
|
element_table = element_table.append(
|
||||||
|
pd.Series(
|
||||||
|
data={
|
||||||
|
"id": 1,
|
||||||
|
"competence": "Rechercher",
|
||||||
|
"theme": "",
|
||||||
|
"comment": "",
|
||||||
|
"score_rate": 1,
|
||||||
|
"is_leveled": 1,
|
||||||
|
},
|
||||||
|
name=0,
|
||||||
|
)
|
||||||
|
)
|
||||||
new_exercise = html.Div(
|
new_exercise = html.Div(
|
||||||
children=[
|
children=[
|
||||||
html.Div(
|
html.Div(
|
||||||
@ -162,7 +174,7 @@ def add_exercise(n_clicks, children):
|
|||||||
editable=True,
|
editable=True,
|
||||||
row_deletable=True,
|
row_deletable=True,
|
||||||
dropdown={
|
dropdown={
|
||||||
"Competence": {
|
"competence": {
|
||||||
"options": [
|
"options": [
|
||||||
{"label": i, "value": i} for i in config["competences"]
|
{"label": i, "value": i} for i in config["competences"]
|
||||||
]
|
]
|
||||||
@ -205,7 +217,19 @@ def add_element(n_clicks, elements):
|
|||||||
return elements
|
return elements
|
||||||
|
|
||||||
df = pd.DataFrame.from_records(elements)
|
df = pd.DataFrame.from_records(elements)
|
||||||
df = df.append(pd.Series(name=n_clicks))
|
df = df.append(
|
||||||
|
pd.Series(
|
||||||
|
data={
|
||||||
|
"id": len(df) + 1,
|
||||||
|
"competence": "",
|
||||||
|
"theme": "",
|
||||||
|
"comment": "",
|
||||||
|
"score_rate": 1,
|
||||||
|
"is_leveled": 1,
|
||||||
|
},
|
||||||
|
name=n_clicks,
|
||||||
|
)
|
||||||
|
)
|
||||||
return df.to_dict("records")
|
return df.to_dict("records")
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user