Skip to content

Commit

Permalink
Mudando as datas na tabela das turmas para o formato object, conserta…
Browse files Browse the repository at this point in the history
…ndo dois erros.
  • Loading branch information
Oesterd committed Mar 6, 2024
1 parent 42be63d commit 993afe4
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 26 deletions.
7 changes: 1 addition & 6 deletions src/Reusables/Turmas.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@
{'field': 'Professor', "sortable": True, 'filter': False},

{'field': 'Turma', "sortable": True, 'sort': 'asc',
# "valueGetter": {"function": date_obj},
# "valueFormatter": {"function": f"d3.timeFormat('%Y/%m/%d')({date_obj})"},
# "filter": "agDateColumnFilter"
'filterParams': {'buttons': ['reset']}
},

{'field': 'Av Professor',
Expand Down Expand Up @@ -59,9 +57,6 @@
'cellClass': 'center-aligned-cell',
'resizable': True,
'filter': True,
'filterParams': {
"alwaysShowBothConditions": True,
},
'floatingFilter': True,
'suppressMenu': True,
}
Expand Down
35 changes: 19 additions & 16 deletions src/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,29 @@


import pandas as pd
import datetime as dt


app = Dash(__name__, use_pages=True, suppress_callback_exceptions=True)
server = app.server


Dados_notas = pd.read_excel('https://github.com/Oesterd/Dash-learning-analytics/raw/master/dados_teste.xlsx')
Notas_df = Dados_notas.iloc[:, 0:10]
Notas_df = Notas_df.to_dict('records')
ID_notas = '1v6EpUTIYBQF5Sv8lQrHKbK9IJh9mjiaXfUv3rLzliUE'
ID_turmas = '1ZCvar1Hb82foVQHUOMPn7z4YHmvNXICIiF0HIF3Qurk'
Turmas_sheet = 'Curso1'

def read_data(ID, Sheet):

Turmas_df = pd.read_excel('https://github.com/Oesterd/Dash-learning-analytics/raw/master/Dados_turma.xlsx')
Dados = pd.DataFrame(Turmas_df)
Disc = Dados['Disciplina'].unique()
Prof = Dados['Professor'].unique()
Disc.sort(), Prof.sort()
Turmas_df = Turmas_df.to_dict('records')
Data_df = pd.read_csv(f'https://docs.google.com/spreadsheets/d/{ID}/gviz/tq?tqx=out:csv&sheet={Sheet}')

return Data_df


Turmas_df = read_data(ID_turmas, Turmas_sheet)
Disc = Turmas_df['Disciplina'].unique()
Prof = Turmas_df['Professor'].unique()
Disc.sort(), Prof.sort()


page = list(dash.page_registry.values())

Expand Down Expand Up @@ -212,18 +216,17 @@
)
def gather_data(n_intervals):

ID_notas = '1v6EpUTIYBQF5Sv8lQrHKbK9IJh9mjiaXfUv3rLzliUE'
ID_turmas = '1ZCvar1Hb82foVQHUOMPn7z4YHmvNXICIiF0HIF3Qurk'
Turmas_sheet = 'Curso1'

Dados_notas = pd.read_csv(f'https://docs.google.com/spreadsheets/d/{ID_notas}/gviz/tq?tqx=out:csv')
Dados_notas = read_data(ID_notas, 'Sheet1')
Notas_df = Dados_notas.iloc[:, 0:10]
Notas_df = Notas_df.to_dict('records')

Turmas_df = pd.read_csv(f'https://docs.google.com/spreadsheets/d/{ID_turmas}/gviz/tq?tqx=out:csv&sheet={Turmas_sheet}')
Turmas_df = read_data(ID_turmas, Turmas_sheet)
Turmas_df['Turma'] = pd.to_datetime(Turmas_df['Turma'], format='%Y/%m')
Turmas_df['Turma'] = Turmas_df['Turma'].dt.date
print(Turmas_df['Turma'])
Turmas_df = Turmas_df.to_dict('records')


return Notas_df, Turmas_df


Expand Down Expand Up @@ -277,4 +280,4 @@ def drawer_demo(opened, width):


if __name__ == "__main__":
app.run(debug=False, host="0.0.0.0")
app.run(debug=True, host="localhost")
2 changes: 0 additions & 2 deletions src/pages/pg1.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# Importando as bibliotecas
import time

import dash
from dash import html, dcc, Input, Output, State, callback, clientside_callback, ctx
import dash_ag_grid as dag
Expand Down
2 changes: 0 additions & 2 deletions src/pages/pg2.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
import pandas as pd
import scipy.stats

import time



# Iniciando o aplicativo
Expand Down

0 comments on commit 993afe4

Please sign in to comment.