Update Saqel Platform: 2026-09-08 18:49:45
This commit is contained in:
@@ -2,6 +2,7 @@ import 'package:flutter_bloc/flutter_bloc.dart';
|
|||||||
import 'dart:typed_data';
|
import 'dart:typed_data';
|
||||||
import '../../data/models/teacher_models.dart';
|
import '../../data/models/teacher_models.dart';
|
||||||
import '../../data/repositories/teacher_repository.dart';
|
import '../../data/repositories/teacher_repository.dart';
|
||||||
|
import '../../core/utils/app_logger.dart';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ==============================================================================
|
* ==============================================================================
|
||||||
@@ -179,6 +180,7 @@ class TeacherStudioCubit extends Cubit<TeacherStudioState> {
|
|||||||
emit(state.copyWith(curriculumTree: tree, isCurriculumLoading: false));
|
emit(state.copyWith(curriculumTree: tree, isCurriculumLoading: false));
|
||||||
selectGrade(key);
|
selectGrade(key);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
AppLogger.error('Studio upload failed', error: e, tag: 'TEACHER_STUDIO');
|
||||||
emit(state.copyWith(
|
emit(state.copyWith(
|
||||||
isCurriculumLoading: false, errorMessage: e.toString()));
|
isCurriculumLoading: false, errorMessage: e.toString()));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -77,19 +77,10 @@ class _TeacherAuthScreenState extends State<TeacherAuthScreen> {
|
|||||||
SaqelToast.showError(context, 'يرجى إدخال رمز التحقق المكون من 6 أرقام');
|
SaqelToast.showError(context, 'يرجى إدخال رمز التحقق المكون من 6 أرقام');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final hasAnyProfileData = _fullNameController.text.trim().isNotEmpty ||
|
|
||||||
_selectedSubject != null ||
|
|
||||||
_schoolController.text.trim().isNotEmpty ||
|
|
||||||
_selectedGrades.isNotEmpty;
|
|
||||||
final hasCompleteProfileData = _fullNameController.text.trim().isNotEmpty &&
|
final hasCompleteProfileData = _fullNameController.text.trim().isNotEmpty &&
|
||||||
_selectedSubject != null &&
|
_selectedSubject != null &&
|
||||||
_schoolController.text.trim().isNotEmpty &&
|
_schoolController.text.trim().isNotEmpty &&
|
||||||
_selectedGrades.isNotEmpty;
|
_selectedGrades.isNotEmpty;
|
||||||
if (hasAnyProfileData && !hasCompleteProfileData) {
|
|
||||||
SaqelToast.showError(context,
|
|
||||||
'إما اترك بيانات الملف فارغة لتسجيل الدخول، أو أكملها كلها لإنشاء ملف معلم جديد');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
context.read<TeacherAuthCubit>().verifyOtp(
|
context.read<TeacherAuthCubit>().verifyOtp(
|
||||||
phone,
|
phone,
|
||||||
otp,
|
otp,
|
||||||
|
|||||||
@@ -340,10 +340,10 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: matcher
|
name: matcher
|
||||||
sha256: "12956d0ad8390bbcc63ca2e1469c0619946ccb52809807067a7020d57e647aa6"
|
sha256: dc0b7dc7651697ea4ff3e69ef44b0407ea32c487a39fff6a4004fa585e901861
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.12.18"
|
version: "0.12.19"
|
||||||
material_color_utilities:
|
material_color_utilities:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -356,10 +356,10 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: meta
|
name: meta
|
||||||
sha256: "23f08335362185a5ea2ad3a4e597f1375e78bce8a040df5c600c8d3552ef2394"
|
sha256: "1741988757a65eb6b36abe716829688cf01910bbf91c34354ff7ec1c3de2b349"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.17.0"
|
version: "1.18.0"
|
||||||
nested:
|
nested:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -585,10 +585,10 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: test_api
|
name: test_api
|
||||||
sha256: "93167629bfc610f71560ab9312acdda4959de4df6fac7492c89ff0d3886f6636"
|
sha256: "949a932224383300f01be9221c39180316445ecb8e7547f70a41a35bf421fb9e"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.7.9"
|
version: "0.7.11"
|
||||||
typed_data:
|
typed_data:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|||||||
@@ -78,20 +78,20 @@ class VideoController
|
|||||||
} else {
|
} else {
|
||||||
$subjectName = trim((string)($request->getBody()['subject'] ?? $_POST['subject'] ?? ''));
|
$subjectName = trim((string)($request->getBody()['subject'] ?? $_POST['subject'] ?? ''));
|
||||||
$gradeLevel = trim((string)($request->getBody()['grade_level'] ?? $_POST['grade_level'] ?? ''));
|
$gradeLevel = trim((string)($request->getBody()['grade_level'] ?? $_POST['grade_level'] ?? ''));
|
||||||
|
// The production schema uses subjects.name (not name_ar/name_en).
|
||||||
|
// Match the teacher's grade first; the course subject is retained
|
||||||
|
// as the canonical database relation.
|
||||||
$existingCourse = Database::selectOne(
|
$existingCourse = Database::selectOne(
|
||||||
"SELECT c.id, c.teacher_id FROM courses c
|
"SELECT id, teacher_id FROM courses WHERE teacher_id = ? AND grade_level = ? LIMIT 1",
|
||||||
JOIN subjects s ON s.id = c.subject_id
|
[$request->user_id, $gradeLevel]
|
||||||
WHERE c.teacher_id = ? AND c.grade_level = ? AND (s.name_ar = ? OR s.name_en = ?)
|
|
||||||
LIMIT 1",
|
|
||||||
[$request->user_id, $gradeLevel, $subjectName, $subjectName]
|
|
||||||
);
|
);
|
||||||
if ($existingCourse) {
|
if ($existingCourse) {
|
||||||
$courseId = (int)$existingCourse['id'];
|
$courseId = (int)$existingCourse['id'];
|
||||||
$course = $existingCourse;
|
$course = $existingCourse;
|
||||||
} else {
|
} else {
|
||||||
$subject = Database::selectOne(
|
$subject = Database::selectOne(
|
||||||
"SELECT id FROM subjects WHERE name_ar = ? OR name_en = ? ORDER BY id LIMIT 1",
|
"SELECT id FROM subjects WHERE name = ? ORDER BY id LIMIT 1",
|
||||||
[$subjectName, $subjectName]
|
[$subjectName]
|
||||||
) ?: Database::selectOne("SELECT id FROM subjects ORDER BY id LIMIT 1");
|
) ?: Database::selectOne("SELECT id FROM subjects ORDER BY id LIMIT 1");
|
||||||
if (!$subject) {
|
if (!$subject) {
|
||||||
$response->status(409)->json(['status' => 'error', 'message' => 'لا يوجد مبحث معرف لربط الفيديو به']);
|
$response->status(409)->json(['status' => 'error', 'message' => 'لا يوجد مبحث معرف لربط الفيديو به']);
|
||||||
|
|||||||
Reference in New Issue
Block a user