changed old subject type to gradesubject

This commit is contained in:
Kima
2023-10-15 12:14:06 +02:00
parent c7c3b421f4
commit 2d5cbe8799
31 changed files with 497 additions and 156 deletions

View File

@@ -1,6 +1,6 @@
import 'category.dart';
class Subject {
class GradeSubject {
String id;
Category category;
String name;
@@ -8,11 +8,16 @@ class Subject {
bool get isRenamed => renamedTo != null;
Subject({required this.id, required this.category, required this.name, this.renamedTo});
GradeSubject({
required this.id,
required this.category,
required this.name,
this.renamedTo,
});
factory Subject.fromJson(Map json) {
factory GradeSubject.fromJson(Map json) {
final id = json["Uid"] ?? "";
return Subject(
return GradeSubject(
id: id,
category: Category.fromJson(json["Kategoria"] ?? {}),
name: (json["Nev"] ?? "").trim(),
@@ -21,7 +26,7 @@ class Subject {
@override
bool operator ==(other) {
if (other is! Subject) return false;
if (other is! GradeSubject) return false;
return id == other.id;
}