studyTask hozzáadása, SubjectAverage bővítése

This commit is contained in:
2025-09-29 21:43:35 +02:00
committed by Armand
parent f31b719605
commit fd750ae6ad

View File

@@ -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<String, dynamic> 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)';
}
}