Finalização de detalhes e pequenas adições em dashboards de alunos e professores
This commit is contained in:
@@ -2374,11 +2374,13 @@ class _InteractiveQuizSheetState extends State<_InteractiveQuizSheet> {
|
||||
late List<int> _chosen;
|
||||
bool _submitted = false;
|
||||
bool _saving = false;
|
||||
DateTime? _startTime;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_chosen = List.filled(widget.questions.length, -1);
|
||||
_startTime = DateTime.now();
|
||||
}
|
||||
|
||||
void _selectOption(int idx) {
|
||||
@@ -2427,6 +2429,19 @@ class _InteractiveQuizSheetState extends State<_InteractiveQuizSheet> {
|
||||
totalQuestions: widget.questions.length,
|
||||
materialName: widget.title,
|
||||
);
|
||||
|
||||
// Registrar tempo de estudo real
|
||||
if (_startTime != null) {
|
||||
final elapsedDuration = DateTime.now().difference(_startTime!);
|
||||
final elapsedMinutes = elapsedDuration.inMinutes;
|
||||
final elapsedSeconds = elapsedDuration.inSeconds % 60;
|
||||
if (elapsedMinutes > 0 || elapsedSeconds > 0) {
|
||||
Logger.info(
|
||||
'Quiz study time recorded: ${elapsedMinutes}m ${elapsedSeconds}s',
|
||||
);
|
||||
await GamificationService.recordStudyTime(user.uid, elapsedMinutes);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
Logger.error('Error saving quiz result: $e');
|
||||
@@ -2837,11 +2852,13 @@ class _TeacherQuizInteractiveSheetState
|
||||
late List<int> _chosen;
|
||||
bool _submitted = false;
|
||||
bool _saving = false;
|
||||
DateTime? _startTime;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_chosen = List.filled(widget.questions.length, -1);
|
||||
_startTime = DateTime.now();
|
||||
}
|
||||
|
||||
void _selectOption(int idx) {
|
||||
@@ -2914,6 +2931,19 @@ class _TeacherQuizInteractiveSheetState
|
||||
totalQuestions: total,
|
||||
materialName: matName,
|
||||
);
|
||||
|
||||
// Registrar tempo de estudo real
|
||||
if (_startTime != null) {
|
||||
final elapsedDuration = DateTime.now().difference(_startTime!);
|
||||
final elapsedMinutes = elapsedDuration.inMinutes;
|
||||
final elapsedSeconds = elapsedDuration.inSeconds % 60;
|
||||
if (elapsedMinutes > 0 || elapsedSeconds > 0) {
|
||||
Logger.info(
|
||||
'Quiz study time recorded: ${elapsedMinutes}m ${elapsedSeconds}s',
|
||||
);
|
||||
await GamificationService.recordStudyTime(user.uid, elapsedMinutes);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
Logger.error('Error submitting teacher quiz result: $e');
|
||||
|
||||
Reference in New Issue
Block a user