Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -95,25 +95,30 @@ class StudentAnalyzer:
|
|
95 |
|
96 |
def calculate_metrics(self) -> pd.DataFrame:
|
97 |
metrics_df = pd.DataFrame()
|
98 |
-
|
99 |
for _, aluno in self.alunos_df.iterrows():
|
100 |
aluno_pattern = aluno['Aluno_Pattern']
|
101 |
aluno_tarefas = self.tarefas_df[self.tarefas_df['Aluno_Pattern'] == aluno_pattern]
|
102 |
-
|
103 |
if not aluno_tarefas.empty:
|
104 |
duracao_total = aluno_tarefas['Duração'].sum()
|
105 |
acertos_total = aluno_tarefas['Nota'].sum()
|
106 |
-
|
|
|
|
|
|
|
107 |
metrics = {
|
108 |
'Nome do Aluno': aluno['Nome do Aluno'],
|
109 |
'Tarefas Completadas': len(aluno_tarefas),
|
110 |
'Acertos Absolutos': acertos_total,
|
111 |
'Total Tempo': str(duracao_total),
|
112 |
'Tempo Médio por Tarefa': str(duracao_total / len(aluno_tarefas)),
|
113 |
-
'Eficiência':
|
114 |
}
|
115 |
metrics_df = pd.concat([metrics_df, pd.DataFrame([metrics])], ignore_index=True)
|
116 |
-
|
|
|
|
|
117 |
return metrics_df
|
118 |
|
119 |
class ReportGenerator:
|
@@ -248,7 +253,8 @@ class ReportGenerator:
|
|
248 |
pdf.ln()
|
249 |
pdf.cell(0, 10, "Alunos Mais Eficientes:", 0, 1)
|
250 |
for aluno, eficiencia, acertos in self.stats['most_efficient']:
|
251 |
-
|
|
|
252 |
|
253 |
for i, graph in enumerate(graphs):
|
254 |
pdf.add_page()
|
|
|
95 |
|
96 |
def calculate_metrics(self) -> pd.DataFrame:
|
97 |
metrics_df = pd.DataFrame()
|
98 |
+
|
99 |
for _, aluno in self.alunos_df.iterrows():
|
100 |
aluno_pattern = aluno['Aluno_Pattern']
|
101 |
aluno_tarefas = self.tarefas_df[self.tarefas_df['Aluno_Pattern'] == aluno_pattern]
|
102 |
+
|
103 |
if not aluno_tarefas.empty:
|
104 |
duracao_total = aluno_tarefas['Duração'].sum()
|
105 |
acertos_total = aluno_tarefas['Nota'].sum()
|
106 |
+
|
107 |
+
# Calcula eficiência como float diretamente
|
108 |
+
eficiencia = (acertos_total / duracao_total.total_seconds() * 3600)
|
109 |
+
|
110 |
metrics = {
|
111 |
'Nome do Aluno': aluno['Nome do Aluno'],
|
112 |
'Tarefas Completadas': len(aluno_tarefas),
|
113 |
'Acertos Absolutos': acertos_total,
|
114 |
'Total Tempo': str(duracao_total),
|
115 |
'Tempo Médio por Tarefa': str(duracao_total / len(aluno_tarefas)),
|
116 |
+
'Eficiência': eficiencia # Armazena como float, não como string
|
117 |
}
|
118 |
metrics_df = pd.concat([metrics_df, pd.DataFrame([metrics])], ignore_index=True)
|
119 |
+
|
120 |
+
# Converte explicitamente a coluna Eficiência para float
|
121 |
+
metrics_df['Eficiência'] = metrics_df['Eficiência'].astype(float)
|
122 |
return metrics_df
|
123 |
|
124 |
class ReportGenerator:
|
|
|
253 |
pdf.ln()
|
254 |
pdf.cell(0, 10, "Alunos Mais Eficientes:", 0, 1)
|
255 |
for aluno, eficiencia, acertos in self.stats['most_efficient']:
|
256 |
+
# Formata a eficiência com 2 casas decimais ao exibir
|
257 |
+
pdf.cell(0, 10, f"- {aluno}: Eficiência {eficiencia:.2f} (Acertos: {acertos:.0f})", 0, 1)
|
258 |
|
259 |
for i, graph in enumerate(graphs):
|
260 |
pdf.add_page()
|