setted goal plans can be saved now

This commit is contained in:
Kima
2023-08-28 02:33:39 +02:00
parent 3e470981a8
commit 0ac0586fba
7 changed files with 467 additions and 364 deletions

View File

@@ -213,4 +213,15 @@ class UserDatabaseQuery {
return (jsonDecode(renamedTeachersJson) as Map)
.map((key, value) => MapEntry(key.toString(), value.toString()));
}
Future<Map<String, String>> subjectGoalPlans({required String userId}) async {
List<Map> userData =
await db.query("user_data", where: "id = ?", whereArgs: [userId]);
if (userData.isEmpty) return {};
String? goalPlansJson =
userData.elementAt(0)["goal_plans"] as String?;
if (goalPlansJson == null) return {};
return (jsonDecode(goalPlansJson) as Map)
.map((key, value) => MapEntry(key.toString(), value.toString()));
}
}