From fd750ae6adaad09a929b1cd08ac0fbf51f2876a7 Mon Sep 17 00:00:00 2001 From: balint1414 Date: Mon, 29 Sep 2025 21:43:35 +0200 Subject: [PATCH] =?UTF-8?q?studyTask=20hozz=C3=A1ad=C3=A1sa,=20SubjectAver?= =?UTF-8?q?age=20b=C5=91v=C3=ADt=C3=A9se?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- firka/lib/helpers/api/model/class_group.dart | 50 ++++++++++++++++++-- 1 file changed, 45 insertions(+), 5 deletions(-) diff --git a/firka/lib/helpers/api/model/class_group.dart b/firka/lib/helpers/api/model/class_group.dart index a7fec3e7..d4fe2b79 100644 --- a/firka/lib/helpers/api/model/class_group.dart +++ b/firka/lib/helpers/api/model/class_group.dart @@ -7,6 +7,7 @@ class ClassGroup { final UidObj? substituteHeadTeacher; final NameUidDesc studyGroup; final int? studyGroupSortIndex; + final NameUidDesc? studyTask; final bool isActive; final String type; @@ -17,6 +18,7 @@ class ClassGroup { required this.substituteHeadTeacher, required this.studyGroup, required this.studyGroupSortIndex, + required this.studyTask, required this.isActive, required this.type}); @@ -32,6 +34,9 @@ class ClassGroup { : null, studyGroup: NameUidDesc.fromJson(json['OktatasNevelesiKategoria']), studyGroupSortIndex: json['OktatasNevelesiKategoriaSortIndex'], + studyTask: json['OktatasNevelesiFeladat'] != null + ? NameUidDesc.fromJson(json['OktatasNevelesiFeladat']) + : null, isActive: json['IsAktiv'], type: json['Tipus']); } @@ -45,6 +50,7 @@ class ClassGroup { 'substituteHeadTeacher: $substituteHeadTeacher, ' 'studyGroup: $studyGroup, ' 'studyGroupSortIndex: $studyGroupSortIndex, ' + 'studyTask: $studyTask, ' 'isActive: $isActive, ' 'type: "$type"' ')'; @@ -53,19 +59,53 @@ class ClassGroup { class SubjectAverage { final String uid; + final String name; + final String? teacherName; + final String subjectCategoryId; + final String subjectCategoryName; + final String subjectCategoryDescription; + final double? average; + final double? weightedSum; + final double? weightedCount; + final int sortIndex; - SubjectAverage({required this.uid}); + SubjectAverage({ + required this.uid, + required this.name, + this.teacherName, + required this.subjectCategoryId, + required this.subjectCategoryName, + required this.subjectCategoryDescription, + this.average, + this.weightedSum, + this.weightedCount, + required this.sortIndex, + }); factory SubjectAverage.fromJson(Map json) { + final tantargy = json['Tantargy'] ?? {}; + final kategori = tantargy['Kategoria'] ?? {}; + return SubjectAverage( - uid: json['Uid'], + uid: json['Uid'] ?? '', + name: tantargy['Nev'] ?? '', + teacherName: json['TeacherName'], + subjectCategoryId: kategori['Uid'] ?? '', + subjectCategoryName: kategori['Nev'] ?? '', + subjectCategoryDescription: kategori['Leiras'] ?? '', + average: json['Atlag'] != null ? (json['Atlag'] as num).toDouble() : null, + weightedSum: json['SulyozottOsztalyzatOsszege'] != null + ? (json['SulyozottOsztalyzatOsszege'] as num).toDouble() + : null, + weightedCount: json['SulyozottOsztalyzatSzama'] != null + ? (json['SulyozottOsztalyzatSzama'] as num).toDouble() + : null, + sortIndex: tantargy['SortIndex'] ?? 0, ); } @override String toString() { - return 'SubjectAverage(' - 'uid: "$uid"' - ')'; + return 'SubjectAverage(uid: "$uid", name: "$name", category: "$subjectCategoryName", average: $average)'; } }