lot of things done, like custom lesson things
This commit is contained in:
@@ -214,11 +214,13 @@ class UserDatabaseQuery {
|
||||
return lessonCount;
|
||||
}
|
||||
|
||||
Future<DateTime> lastSeen({required String userId, required LastSeenCategory category}) async {
|
||||
Future<DateTime> lastSeen(
|
||||
{required String userId, required LastSeenCategory category}) async {
|
||||
List<Map> userData =
|
||||
await db.query("user_data", where: "id = ?", whereArgs: [userId]);
|
||||
if (userData.isEmpty) return DateTime(0);
|
||||
int? lastSeenDate = userData.elementAt(0)["last_seen_${category.name}"] as int?;
|
||||
int? lastSeenDate =
|
||||
userData.elementAt(0)["last_seen_${category.name}"] as int?;
|
||||
if (lastSeenDate == null) return DateTime(0);
|
||||
DateTime lastSeen = DateTime.fromMillisecondsSinceEpoch(lastSeenDate);
|
||||
return lastSeen;
|
||||
@@ -348,4 +350,15 @@ class UserDatabaseQuery {
|
||||
.toList();
|
||||
return accounts;
|
||||
}
|
||||
|
||||
Future<Map<String, String>> getCustomLessonDescriptions(
|
||||
{required String userId}) async {
|
||||
List<Map> userData =
|
||||
await db.query("user_data", where: "id = ?", whereArgs: [userId]);
|
||||
if (userData.isEmpty) return {};
|
||||
String? descJson = userData.elementAt(0)["custom_lesson_desc"] as String?;
|
||||
if (descJson == null) return {};
|
||||
return (jsonDecode(descJson) as Map)
|
||||
.map((key, value) => MapEntry(key.toString(), value.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user