Update Saqel Platform: 2026-09-08 23:44:33

This commit is contained in:
Hamza-Ayed
2026-09-08 23:44:33 +03:00
parent 41493f5dd6
commit be60f34148
3 changed files with 42 additions and 4 deletions
@@ -425,8 +425,9 @@ class TeacherRepository {
);
final decoded = json.decode(response.body) as Map<String, dynamic>;
if (response.statusCode == 200 || response.statusCode == 201)
if (response.statusCode == 200 || response.statusCode == 201 || response.statusCode == 422) {
return decoded;
}
throw StateError(
decoded['message']?.toString() ?? 'رفض الخادم رفع الحصة.');
} on StateError {
@@ -314,6 +314,7 @@ class TeacherStudioCubit extends Cubit<TeacherStudioState> {
fileBytes: state.selectedFileBytes,
);
final status = res['status']?.toString();
final data = res['data'] is Map
? Map<String, dynamic>.from(res['data'] as Map)
: <String, dynamic>{};
@@ -325,6 +326,19 @@ class TeacherStudioCubit extends Cubit<TeacherStudioState> {
'lesson_title': state.lessonTitle,
'subject': selectedSubjectName
});
if (status == 'needs_review' || report['decision'] == 'needs_manual_review' || report['decision'] == 'rejected') {
final reason = report['reason']?.toString() ?? res['message']?.toString() ?? 'لم يجتز الفيديو تدقيق الجودة.';
emit(state.copyWith(
isAuditing: false,
isUploading: false,
isUploaded: false,
auditResult: result,
errorMessage: reason,
));
return false;
}
final msg = res['message']?.toString() ?? 'تم اعتماد الحصة ورفعها بنجاح.';
emit(state.copyWith(
isAuditing: false,