From 42be63dc9484787bd34d47ccc7920818290aff02 Mon Sep 17 00:00:00 2001 From: Oesterd Date: Tue, 5 Mar 2024 07:50:40 -0300 Subject: [PATCH] =?UTF-8?q?Retornando=20a=20op=C3=A7=C3=A3o=20de=20selecio?= =?UTF-8?q?nar=20os=20professores=20e=20disciplinas=20com=20dropdowns=20mu?= =?UTF-8?q?lti=20nas=20p=C3=A1ginas=204=20e=205.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Reusables/Sidebars.py | 12 +++++++++++- src/pages/pg4.py | 17 +++++++++++++++-- src/pages/pg5.py | 16 +++++++++++++++- 3 files changed, 41 insertions(+), 4 deletions(-) diff --git a/src/Reusables/Sidebars.py b/src/Reusables/Sidebars.py index 7526d8e..3db3ae7 100644 --- a/src/Reusables/Sidebars.py +++ b/src/Reusables/Sidebars.py @@ -209,6 +209,17 @@ def pg5(): ), + html.Div([ + dmc.MultiSelect(id='Mdropdown51', label='Escolha a(s) disciplina(s)', value=[], + data=Disc, searchable=True, clearable=True) + ]), + + + html.Div([ + dmc.MultiSelect(id='Mdropdown52', label='Escolha o(s) professor(es)', value=[], + data=Prof, searchable=True, clearable=True) + ]), + html.Div([ html.Div([ @@ -218,7 +229,6 @@ def pg5(): ]), - html.Div([ dmc.Select(id='dropdown52', label='Regressão linear:', value=None, data=[ diff --git a/src/pages/pg4.py b/src/pages/pg4.py index 848548d..6fc3f40 100644 --- a/src/pages/pg4.py +++ b/src/pages/pg4.py @@ -60,10 +60,24 @@ @callback( Output('grid3', 'rowData'), Input('Dados_turmas', 'data'), + Input(component_id='Mdropdown41', component_property='value'), + Input(component_id='Mdropdown42', component_property='value'), ) -def Grid_maker(data): +def Grid_maker(data, mdrop1, mdrop2): + dff = pd.DataFrame(data) + + + if mdrop1: + dff = dff[dff['Disciplina'].isin(mdrop1)] + + if mdrop2: + dff = dff[dff['Professor'].isin(mdrop2)] + + + data = dff.to_dict('records') + return data @@ -90,7 +104,6 @@ def filterdata(n, rows, drop1): dff = pd.DataFrame(rows) - # Transformando os dados no eixo y em uma razão ao invés de número absoluto if drop1 == 'Média turma': var = drop1 diff --git a/src/pages/pg5.py b/src/pages/pg5.py index 212c69f..e782771 100644 --- a/src/pages/pg5.py +++ b/src/pages/pg5.py @@ -81,10 +81,24 @@ @callback( Output('grid4', 'rowData'), Input('Dados_turmas', 'data'), + Input(component_id='Mdropdown51', component_property='value'), + Input(component_id='Mdropdown52', component_property='value'), ) -def Grid_maker(data): +def Grid_maker(data, mdrop1, mdrop2): + dff = pd.DataFrame(data) + + + if mdrop1: + dff = dff[dff['Disciplina'].isin(mdrop1)] + + if mdrop2: + dff = dff[dff['Professor'].isin(mdrop2)] + + + data = dff.to_dict('records') + return data