Skip to content

Commit

Permalink
Filtro de estilo de aprendizagem
Browse files Browse the repository at this point in the history
  • Loading branch information
camilamaia committed Nov 8, 2024
1 parent d1a15d0 commit e671e41
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions curadoria_coletiva/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,18 @@ def _create_filter_dropdowns(df):
style={"width": "100%"},
multi=True, # Aqui tornamos o campo "Formato" multi-selecionável
),
dcc.Dropdown(
id="learning-style-dropdown",
options=[
{"label": "Estilo Visual", "value": "visual"},
{"label": "Estilo Auditivo", "value": "auditivo"},
{"label": "Estilo Cinestésico", "value": "cinestésico"},
],
multi=True,
placeholder="Estilo de aprendizagem",
style={"width": "100%"},
),

dcc.Dropdown(
id="sort-dropdown",
options=[
Expand Down Expand Up @@ -257,10 +269,11 @@ def _register_callbacks(app, df):
Input("search-box", "value"),
Input("subject-dropdown", "value"),
Input("format-dropdown", "value"),
Input("learning-style-dropdown", "value"), # Novo filtro de estilo de aprendizagem
Input("sort-dropdown", "value"),
)
def update_table(search_term, selected_subject, selected_format, sort_column):
"""Updates the table layout based on search, subject, format, and sorting filters."""
def update_table(search_term, selected_subject, selected_format, selected_learning_style, sort_column):
"""Atualiza a tabela com base nos filtros de busca, assunto, formato, estilo de aprendizagem e ordenação."""
filtered_df = df

# Aplicar o filtro de busca
Expand All @@ -278,10 +291,14 @@ def update_table(search_term, selected_subject, selected_format, sort_column):
filtered_df["assuntos"].apply(lambda x: all(cat in x for cat in selected_subject))
]

# Aplicar o filtro de formato (exigindo que seja pela uma das seleções)
# Aplicar o filtro de formato (verificando se múltiplos valores foram selecionados)
if selected_format:
filtered_df = filtered_df[filtered_df["formato"].isin(selected_format)]

# Aplicar o filtro de estilo de aprendizagem (verificando se múltiplos valores foram selecionados)
if selected_learning_style:
filtered_df = filtered_df[filtered_df["estilo_aprendizagem"].isin(selected_learning_style)]

# Aplicar o filtro de ordenação
if sort_column:
filtered_df = filtered_df.sort_values(by=sort_column)
Expand All @@ -294,6 +311,7 @@ def update_table(search_term, selected_subject, selected_format, sort_column):
return html.Div("Nenhum resultado encontrado.", style={"color": "red", "text-align": "center", "margin-top": "20px"})



data = _load_yaml_data(yaml_file_path)
df = _create_dataframe(data)

Expand Down

0 comments on commit e671e41

Please sign in to comment.