Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -156,7 +156,6 @@ def generate_pdf_report(dataframe, media_tempo_medio_turma, html_path, output_pd
|
|
156 |
self.image(image_path, x=10, y=10, w=270)
|
157 |
|
158 |
pdf = PDF(orientation='L', unit='mm', format='A4')
|
159 |
-
pdf.add_page()
|
160 |
|
161 |
# Gerar gráficos e adicionar ao PDF
|
162 |
def add_bar_labels(bars):
|
@@ -206,6 +205,20 @@ def generate_pdf_report(dataframe, media_tempo_medio_turma, html_path, output_pd
|
|
206 |
plt.savefig(graph_path)
|
207 |
pdf.add_image(graph_path)
|
208 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
209 |
# Salvar o PDF com os gráficos
|
210 |
temp_graphics_pdf = 'temp_graphics.pdf'
|
211 |
pdf.output(temp_graphics_pdf)
|
|
|
156 |
self.image(image_path, x=10, y=10, w=270)
|
157 |
|
158 |
pdf = PDF(orientation='L', unit='mm', format='A4')
|
|
|
159 |
|
160 |
# Gerar gráficos e adicionar ao PDF
|
161 |
def add_bar_labels(bars):
|
|
|
205 |
plt.savefig(graph_path)
|
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})')
|
215 |
+
plt.xticks(rotation=45, ha='right')
|
216 |
+
add_bar_labels(bars)
|
217 |
+
plt.tight_layout()
|
218 |
+
graph_path = 'top_5_tempo_total.png'
|
219 |
+
plt.savefig(graph_path)
|
220 |
+
pdf.add_image(graph_path)
|
221 |
+
|
222 |
# Salvar o PDF com os gráficos
|
223 |
temp_graphics_pdf = 'temp_graphics.pdf'
|
224 |
pdf.output(temp_graphics_pdf)
|