Update Saqel Platform: 2026-09-08 13:43:36
This commit is contained in:
@@ -67,23 +67,6 @@ class GuardianCubit extends Cubit<GuardianState> {
|
||||
: _guardianRepo = guardianRepo ?? GuardianRepository(),
|
||||
super(GuardianInitial());
|
||||
|
||||
List<GuardianChildModel> _getFallbackChildren() {
|
||||
return [
|
||||
GuardianChildModel(
|
||||
id: 1,
|
||||
uuid: 'std-10-sama-01',
|
||||
name: 'سما حمزة',
|
||||
nationalId: '2009102450',
|
||||
gradeLevel: 'الصف العاشر الأساسي',
|
||||
stream: 'المسار الأكاديمي (علمي)',
|
||||
schoolName: 'مدرسة الملك عبد الله الثاني للتميز',
|
||||
readinessScore: 92.0,
|
||||
examsPassed: 18,
|
||||
examsTotal: 20,
|
||||
),
|
||||
];
|
||||
}
|
||||
|
||||
Future<void> fetchDashboard() async {
|
||||
AppLogger.log('Fetching guardian dashboard children from API...', tag: 'GUARDIAN_CUBIT');
|
||||
emit(GuardianLoading());
|
||||
@@ -91,13 +74,13 @@ class GuardianCubit extends Cubit<GuardianState> {
|
||||
final children = await _guardianRepo.getDashboardChildren();
|
||||
AppLogger.log('Fetched ${children.length} linked children from API', tag: 'GUARDIAN_CUBIT');
|
||||
if (children.isEmpty) {
|
||||
emit(GuardianLoaded(children: _getFallbackChildren(), selectedChildIndex: 0));
|
||||
emit(GuardianEmpty());
|
||||
} else {
|
||||
emit(GuardianLoaded(children: children, selectedChildIndex: 0));
|
||||
}
|
||||
} catch (e) {
|
||||
AppLogger.error('Fetch guardian dashboard failed, using resilient student link', error: e, tag: 'GUARDIAN_CUBIT');
|
||||
emit(GuardianLoaded(children: _getFallbackChildren(), selectedChildIndex: 0));
|
||||
AppLogger.error('Fetch guardian dashboard failed', error: e, tag: 'GUARDIAN_CUBIT');
|
||||
emit(GuardianError(e.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user