Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -409,13 +409,19 @@ class ReportGenerator:
|
|
| 409 |
pdf.set_font('Arial', 'B', 14)
|
| 410 |
pdf.set_fill_color(240, 240, 240)
|
| 411 |
|
| 412 |
-
#
|
| 413 |
-
|
|
|
|
|
|
|
| 414 |
|
|
|
|
| 415 |
media_acertos = alunos_nivel['Acertos Absolutos'].mean()
|
| 416 |
media_tarefas = alunos_nivel['Tarefas Completadas'].mean()
|
| 417 |
-
|
| 418 |
-
|
|
|
|
|
|
|
|
|
|
| 419 |
|
| 420 |
# Cabeçalho da seção
|
| 421 |
pdf.cell(0, 10, f'Detalhamento - Nível {nivel}', 0, 1, 'L', True)
|
|
@@ -444,14 +450,13 @@ class ReportGenerator:
|
|
| 444 |
# Dados dos alunos
|
| 445 |
pdf.set_font('Arial', '', 10)
|
| 446 |
for i, (_, row) in enumerate(alunos_nivel.iterrows()):
|
| 447 |
-
|
| 448 |
# Alternar cores das linhas
|
| 449 |
fill_color = (248, 248, 248) if i % 2 == 0 else (255, 255, 255)
|
| 450 |
pdf.set_fill_color(*fill_color)
|
| 451 |
|
| 452 |
-
# Calcular taxa de aproveitamento
|
| 453 |
total_questoes = row['Tarefas Completadas'] * questoes_por_tarefa
|
| 454 |
-
taxa_aproveitamento = (row['Acertos Absolutos']
|
| 455 |
taxa_aproveitamento = min(taxa_aproveitamento, 100) # Limitar a 100%
|
| 456 |
|
| 457 |
# Formatar tempo
|
|
|
|
| 409 |
pdf.set_font('Arial', 'B', 14)
|
| 410 |
pdf.set_fill_color(240, 240, 240)
|
| 411 |
|
| 412 |
+
# Função auxiliar para calcular taxa de aproveitamento
|
| 413 |
+
def calcular_taxa(acertos: float, questoes_total: float) -> float:
|
| 414 |
+
"""Calcula taxa de aproveitamento considerando total de questões real"""
|
| 415 |
+
return (acertos / questoes_total * 100) if questoes_total > 0 else 0
|
| 416 |
|
| 417 |
+
# Calcular estatísticas do nível
|
| 418 |
media_acertos = alunos_nivel['Acertos Absolutos'].mean()
|
| 419 |
media_tarefas = alunos_nivel['Tarefas Completadas'].mean()
|
| 420 |
+
|
| 421 |
+
# Para a média geral, vamos usar 4 questões por tarefa como base
|
| 422 |
+
questoes_por_tarefa = 4 # Média de questões por tarefa
|
| 423 |
+
total_questoes_media = media_tarefas * questoes_por_tarefa
|
| 424 |
+
taxa_media = calcular_taxa(media_acertos, total_questoes_media)
|
| 425 |
|
| 426 |
# Cabeçalho da seção
|
| 427 |
pdf.cell(0, 10, f'Detalhamento - Nível {nivel}', 0, 1, 'L', True)
|
|
|
|
| 450 |
# Dados dos alunos
|
| 451 |
pdf.set_font('Arial', '', 10)
|
| 452 |
for i, (_, row) in enumerate(alunos_nivel.iterrows()):
|
|
|
|
| 453 |
# Alternar cores das linhas
|
| 454 |
fill_color = (248, 248, 248) if i % 2 == 0 else (255, 255, 255)
|
| 455 |
pdf.set_fill_color(*fill_color)
|
| 456 |
|
| 457 |
+
# Calcular taxa de aproveitamento individual
|
| 458 |
total_questoes = row['Tarefas Completadas'] * questoes_por_tarefa
|
| 459 |
+
taxa_aproveitamento = calcular_taxa(row['Acertos Absolutos'], total_questoes)
|
| 460 |
taxa_aproveitamento = min(taxa_aproveitamento, 100) # Limitar a 100%
|
| 461 |
|
| 462 |
# Formatar tempo
|