Update Saqel Platform: 2026-09-12 13:38:49
This commit is contained in:
@@ -4,6 +4,7 @@ import '../../core/utils/app_logger.dart';
|
||||
import '../../data/models/socratic_checkpoint_model.dart';
|
||||
import '../../data/models/subject_model.dart';
|
||||
import '../../data/repositories/curriculum_repository.dart';
|
||||
import '../../data/repositories/error_notebook_repository.dart';
|
||||
|
||||
abstract class VideoPlaybackState {}
|
||||
|
||||
@@ -179,6 +180,20 @@ class VideoPlaybackCubit extends Cubit<VideoPlaybackState> {
|
||||
}
|
||||
}
|
||||
|
||||
void pause() {
|
||||
final currentState = state;
|
||||
if (currentState is VideoPlaybackReady && currentState.isPlaying) {
|
||||
emit(currentState.copyWith(isPlaying: false));
|
||||
}
|
||||
}
|
||||
|
||||
void play() {
|
||||
final currentState = state;
|
||||
if (currentState is VideoPlaybackReady && !currentState.isPlaying && currentState.activeCheckpoint == null) {
|
||||
emit(currentState.copyWith(isPlaying: true));
|
||||
}
|
||||
}
|
||||
|
||||
void seekTo(int seconds) {
|
||||
final currentState = state;
|
||||
if (currentState is VideoPlaybackReady) {
|
||||
@@ -271,6 +286,26 @@ class VideoPlaybackCubit extends Cubit<VideoPlaybackState> {
|
||||
isPlaying: true,
|
||||
remediationNotice: 'تعثرت في هذا المفهوم. تم إرجاع الفيديو ${cp.rewindSecondsOnFail} ثانية لإعادة الاستماع بتركيز 🔄',
|
||||
));
|
||||
|
||||
// Auto-record gap to Smart Error Notebook
|
||||
final correctOpt = cp.options.firstWhere(
|
||||
(o) => o.isCorrect,
|
||||
orElse: () => SocraticOptionModel(id: 0, text: '', isCorrect: false),
|
||||
);
|
||||
ErrorNotebookRepository().logError(
|
||||
subjectId: currentState.subject?.id ?? 'physics_10',
|
||||
subjectName: currentState.subject?.title ?? 'المادة الدراسية',
|
||||
topicName: currentState.lessonItem?.title ?? 'وقفة فحص تفاعلية',
|
||||
sourceType: 'socratic_checkpoint',
|
||||
questionText: cp.questionText,
|
||||
studentWrongAnswer: selectedOption.text,
|
||||
correctAnswer: correctOpt.text,
|
||||
hint: cp.hint,
|
||||
errorCategory: 'conceptual',
|
||||
lessonId: currentState.playbackData.lessonId > 0 ? currentState.playbackData.lessonId : null,
|
||||
options: cp.options.map((o) => o.text).toList(),
|
||||
);
|
||||
|
||||
if (cp.id > 0 && cp.questionId > 0) {
|
||||
_repo.submitCheckpoint(examId: cp.id, questionId: cp.questionId, optionId: selectedOption.id).catchError((e) {
|
||||
AppLogger.log('Checkpoint sync deferred: $e', tag: 'VIDEO_CUBIT');
|
||||
|
||||
Reference in New Issue
Block a user