Update Saqel Platform: 2026-09-12 13:38:49

This commit is contained in:
Hamza-Ayed
2026-09-12 13:38:49 +03:00
parent 1f31369893
commit f4d4f02853
34 changed files with 9136 additions and 386 deletions
@@ -71,6 +71,10 @@ class GuardianChildModel {
final double readinessScore;
final int examsPassed;
final int examsTotal;
final int errorTotalCount;
final int errorMasteredCount;
final int errorPendingCount;
final double errorMasteryRate;
GuardianChildModel({
required this.id,
@@ -83,6 +87,10 @@ class GuardianChildModel {
this.readinessScore = 0.0,
this.examsPassed = 0,
this.examsTotal = 0,
this.errorTotalCount = 0,
this.errorMasteredCount = 0,
this.errorPendingCount = 0,
this.errorMasteryRate = 100.0,
});
factory GuardianChildModel.fromJson(Map<String, dynamic> json) {
@@ -93,6 +101,31 @@ class GuardianChildModel {
? Map<String, dynamic>.from(json['metrics'])
: <String, dynamic>{};
final source = <String, dynamic>{...student, ...metrics, ...json};
final errorNotebook = metrics['error_notebook'] is Map
? Map<String, dynamic>.from(metrics['error_notebook'])
: <String, dynamic>{};
final errTotal = errorNotebook['total_errors'] is int
? errorNotebook['total_errors'] as int
: (source['errors_total'] is int
? source['errors_total'] as int
: int.tryParse(errorNotebook['total_errors']?.toString() ?? source['errors_total']?.toString() ?? '0') ?? 0);
final errMastered = errorNotebook['mastered_count'] is int
? errorNotebook['mastered_count'] as int
: (source['errors_mastered'] is int
? source['errors_mastered'] as int
: int.tryParse(errorNotebook['mastered_count']?.toString() ?? source['errors_mastered']?.toString() ?? '0') ?? 0);
final errPending = errorNotebook['pending_count'] is int
? errorNotebook['pending_count'] as int
: (source['errors_pending'] is int
? source['errors_pending'] as int
: int.tryParse(errorNotebook['pending_count']?.toString() ?? source['errors_pending']?.toString() ?? '0') ?? 0);
final errRate = errorNotebook['mastery_percentage'] != null
? double.tryParse(errorNotebook['mastery_percentage'].toString()) ?? 100.0
: (source['errors_mastery_rate'] != null
? double.tryParse(source['errors_mastery_rate'].toString()) ?? 100.0
: (errTotal > 0 ? (errMastered / errTotal) * 100 : 100.0));
return GuardianChildModel(
id: source['id'] is int ? source['id'] : int.tryParse(source['id']?.toString() ?? '0') ?? 0,
uuid: source['uuid']?.toString() ?? '',
@@ -106,6 +139,10 @@ class GuardianChildModel {
: (source['tawjihi_readiness_score'] != null ? double.tryParse(source['tawjihi_readiness_score'].toString()) ?? 0.0 : 0.0),
examsPassed: source['exams_passed_count'] is int ? source['exams_passed_count'] : int.tryParse(source['exams_passed_count']?.toString() ?? '0') ?? 0,
examsTotal: source['exams_total_count'] is int ? source['exams_total_count'] : int.tryParse(source['exams_total_count']?.toString() ?? '0') ?? 0,
errorTotalCount: errTotal,
errorMasteredCount: errMastered,
errorPendingCount: errPending,
errorMasteryRate: errRate,
);
}
}