VERSAO FINAL (core features)
This commit is contained in:
@@ -45,7 +45,8 @@ class _TeacherHeroWidgetState extends State<TeacherHeroWidget> {
|
||||
|
||||
for (final classDoc in classesSnapshot.docs) {
|
||||
final classId = classDoc.id;
|
||||
final stats = await GamificationService.getClassStats(classId);
|
||||
// Forçar atualização para obter dados mais recentes
|
||||
final stats = await GamificationService.getClassStats(classId, forceRefresh: true);
|
||||
if (stats != null) {
|
||||
classStatsList.add(stats);
|
||||
}
|
||||
@@ -73,7 +74,18 @@ class _TeacherHeroWidgetState extends State<TeacherHeroWidget> {
|
||||
double get classAverageProgress {
|
||||
if (_classStats.isEmpty) return 0.0;
|
||||
final totalProgress = _classStats.fold(0.0, (sum, stats) => sum + stats.averageProgress);
|
||||
return totalProgress / _classStats.length;
|
||||
final average = totalProgress / _classStats.length;
|
||||
|
||||
print('=== UI PROGRESS DEBUG ===');
|
||||
print('Number of classes: ${_classStats.length}');
|
||||
for (int i = 0; i < _classStats.length; i++) {
|
||||
print('Class ${i + 1}: ${_classStats[i].className} - ${_classStats[i].averageProgress} (${(_classStats[i].averageProgress * 100).toInt()}%)');
|
||||
}
|
||||
print('Total progress sum: $totalProgress');
|
||||
print('Calculated average: $average (${(average * 100).toInt()}%)');
|
||||
print('=== END UI PROGRESS DEBUG ===');
|
||||
|
||||
return average;
|
||||
}
|
||||
|
||||
Widget build(BuildContext context) {
|
||||
@@ -184,13 +196,22 @@ class _TeacherHeroWidgetState extends State<TeacherHeroWidget> {
|
||||
),
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'${(classAverageProgress * 100).toInt()}%',
|
||||
style: const TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 24,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
Builder(
|
||||
builder: (context) {
|
||||
final displayValue = (classAverageProgress * 100).toInt();
|
||||
print('=== RENDER DEBUG ===');
|
||||
print('classAverageProgress: $classAverageProgress');
|
||||
print('displayValue: $displayValue%');
|
||||
print('=== END RENDER DEBUG ===');
|
||||
return Text(
|
||||
'$displayValue%',
|
||||
style: const TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 24,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user