histlearn commited on
Commit
25b934a
·
verified ·
1 Parent(s): eac77c7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +45 -45
app.py CHANGED
@@ -184,56 +184,56 @@ class ReportGenerator:
184
 
185
  pdf = PDF('L', 'mm', 'A4')
186
 
187
- # Sumário executivo
188
- pdf.add_page()
189
- pdf.set_font('Arial', 'B', 12)
190
- pdf.cell(0, 10, 'Sumário Executivo', 0, 1)
191
- pdf.set_font('Arial', '', 10)
192
 
193
- # Usando - em vez de • para compatibilidade
194
- summary_text = f"""
195
- Análise da Turma:
196
- - Média de Acertos: {self.stats['media_acertos']:.1f}%
197
- - Desvio Padrão: {self.stats['desvio_padrao']:.1f}%
198
- - Mediana: {self.stats['mediana_acertos']:.1f}%
199
- - Número de Alunos: {self.stats['total_alunos']}
200
- - Média de Tarefas por Aluno: {self.stats['media_tarefas']:.1f}
201
- - Tempo Médio Total: {self.stats['media_tempo']}
202
- """
203
- pdf.multi_cell(0, 10, summary_text)
204
-
205
- # Gráficos
206
- for i, graph in enumerate(graphs):
207
- pdf.add_page()
208
- graph_path = f'temp_graph_{i}.png'
209
- graph.savefig(graph_path)
210
- pdf.image(graph_path, x=10, y=30, w=270)
211
- os.remove(graph_path)
212
-
213
- # Tabela de alunos
214
  pdf.add_page()
215
- pdf.set_font('Arial', 'B', 12)
216
- pdf.cell(0, 10, 'Desempenho Individual', 0, 1)
 
 
 
 
 
 
 
217
 
218
- # Cabeçalhos
219
- columns = ['Nome do Aluno', 'Média de Acertos', 'Tarefas', 'Tempo Total', 'Eficiência']
220
- widths = [80, 30, 30, 30, 30]
221
- pdf.set_font('Arial', 'B', 8)
222
- for i, col in enumerate(columns):
223
- pdf.cell(widths[i], 7, col, 1)
 
 
 
 
 
 
 
 
 
 
224
  pdf.ln()
225
 
226
- # Dados
227
- pdf.set_font('Arial', '', 8)
228
- for _, row in self.data.iterrows():
229
- pdf.cell(widths[0], 6, str(row['Nome do Aluno'])[:40], 1)
230
- pdf.cell(widths[1], 6, str(row['Média de Acertos']), 1)
231
- pdf.cell(widths[2], 6, str(row['Tarefas Completadas']), 1)
232
- pdf.cell(widths[3], 6, str(row['Total Tempo']), 1)
233
- pdf.cell(widths[4], 6, str(row['Eficiência']), 1)
234
- pdf.ln()
235
-
236
- pdf.output(output_path)
237
 
238
  def process_files(html_file, excel_files) -> Tuple[str, str, str]:
239
  """Processa arquivos e gera relatório."""
 
184
 
185
  pdf = PDF('L', 'mm', 'A4')
186
 
187
+ # Sumário executivo
188
+ pdf.add_page()
189
+ pdf.set_font('Arial', 'B', 12)
190
+ pdf.cell(0, 10, 'Sumário Executivo', 0, 1)
191
+ pdf.set_font('Arial', '', 10)
192
 
193
+ # Usando - em vez de • para compatibilidade
194
+ summary_text = f"""
195
+ Análise da Turma:
196
+ - Média de Acertos: {self.stats['media_acertos']:.1f}%
197
+ - Desvio Padrão: {self.stats['desvio_padrao']:.1f}%
198
+ - Mediana: {self.stats['mediana_acertos']:.1f}%
199
+ - Número de Alunos: {self.stats['total_alunos']}
200
+ - Média de Tarefas por Aluno: {self.stats['media_tarefas']:.1f}
201
+ - Tempo Médio Total: {self.stats['media_tempo']}
202
+ """
203
+ pdf.multi_cell(0, 10, summary_text)
204
+
205
+ # Gráficos
206
+ for i, graph in enumerate(graphs):
 
 
 
 
 
 
 
207
  pdf.add_page()
208
+ graph_path = f'temp_graph_{i}.png'
209
+ graph.savefig(graph_path)
210
+ pdf.image(graph_path, x=10, y=30, w=270)
211
+ os.remove(graph_path)
212
+
213
+ # Tabela de alunos
214
+ pdf.add_page()
215
+ pdf.set_font('Arial', 'B', 12)
216
+ pdf.cell(0, 10, 'Desempenho Individual', 0, 1)
217
 
218
+ # Cabeçalhos
219
+ columns = ['Nome do Aluno', 'Média de Acertos', 'Tarefas', 'Tempo Total', 'Eficiência']
220
+ widths = [80, 30, 30, 30, 30]
221
+ pdf.set_font('Arial', 'B', 8)
222
+ for i, col in enumerate(columns):
223
+ pdf.cell(widths[i], 7, col, 1)
224
+ pdf.ln()
225
+
226
+ # Dados
227
+ pdf.set_font('Arial', '', 8)
228
+ for _, row in self.data.iterrows():
229
+ pdf.cell(widths[0], 6, str(row['Nome do Aluno'])[:40], 1)
230
+ pdf.cell(widths[1], 6, str(row['Média de Acertos']), 1)
231
+ pdf.cell(widths[2], 6, str(row['Tarefas Completadas']), 1)
232
+ pdf.cell(widths[3], 6, str(row['Total Tempo']), 1)
233
+ pdf.cell(widths[4], 6, str(row['Eficiência']), 1)
234
  pdf.ln()
235
 
236
+ pdf.output(output_path)
 
 
 
 
 
 
 
 
 
 
237
 
238
  def process_files(html_file, excel_files) -> Tuple[str, str, str]:
239
  """Processa arquivos e gera relatório."""