histlearn commited on
Commit
1b67de8
verified
1 Parent(s): 4c12aef

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -206,9 +206,10 @@ def generate_pdf_report(dataframe, media_tempo_medio_turma, html_path, output_pd
206
  pdf.add_image(graph_path)
207
 
208
  # Adiciona gr谩fico de alunos que passam mais tempo fazendo as tarefas
 
209
  top_time_students = dataframe.nlargest(5, 'Total Tempo')
210
  plt.figure(figsize=(10, 6))
211
- bars = plt.bar(top_time_students['Nome do Aluno'], top_time_students['Total Tempo'].apply(lambda x: x.total_seconds() / 60), color='purple')
212
  plt.xlabel('Nome do Aluno')
213
  plt.ylabel('Tempo Total (minutos)')
214
  plt.title(f'Top 5 Alunos - Tempo Total (Tempo M茅dio da Turma: {media_tempo_medio_turma})')
@@ -283,7 +284,7 @@ def processar_relatorio(html_file, tarefa_files):
283
 
284
  # Salva o relat贸rio em HTML e PDF
285
  html_output_path = os.path.join(output_directory, "relatorio_final.html")
286
- df.to_html(html_output_path, index=False)
287
 
288
  pdf_output_path = os.path.join(output_directory, "relatorio_final.pdf")
289
  generate_pdf_report(df, media_tempo_medio_turma, html_output_path, pdf_output_path)
 
206
  pdf.add_image(graph_path)
207
 
208
  # Adiciona gr谩fico de alunos que passam mais tempo fazendo as tarefas
209
+ dataframe['Total Tempo'] = pd.to_timedelta(dataframe['Total Tempo'])
210
  top_time_students = dataframe.nlargest(5, 'Total Tempo')
211
  plt.figure(figsize=(10, 6))
212
+ bars = plt.bar(top_time_students['Nome do Aluno'], top_time_students['Total Tempo'].dt.total_seconds() / 60, color='purple')
213
  plt.xlabel('Nome do Aluno')
214
  plt.ylabel('Tempo Total (minutos)')
215
  plt.title(f'Top 5 Alunos - Tempo Total (Tempo M茅dio da Turma: {media_tempo_medio_turma})')
 
284
 
285
  # Salva o relat贸rio em HTML e PDF
286
  html_output_path = os.path.join(output_directory, "relatorio_final.html")
287
+ df.to_html(html_output_path, index=False, encoding='utf-8')
288
 
289
  pdf_output_path = os.path.join(output_directory, "relatorio_final.pdf")
290
  generate_pdf_report(df, media_tempo_medio_turma, html_output_path, pdf_output_path)