Skip to content

Commit c47d02e

Browse files
committed
fixed tags deletion ccsync problem
1 parent 4779a31 commit c47d02e

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

lib/app/v3/db/task_database.dart

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -149,12 +149,12 @@ class TaskDatabase {
149149

150150
Future<void> updateTask(TaskForC task) async {
151151
await ensureDatabaseIsOpen();
152-
debugPrint("Database Insert");
152+
debugPrint("Database update");
153153
List<String> taskTags = task.tags?.map((e) => e.toString()).toList() ?? [];
154-
debugPrint("Database Insert $taskTags");
154+
debugPrint("Database update $taskTags");
155155
List<String> taskDepends =
156156
task.tags?.map((e) => e.toString()).toList() ?? [];
157-
debugPrint("Database Insert $taskDepends");
157+
debugPrint("Database update $taskDepends");
158158
List<Map<String, String?>> taskAnnotations = task.annotations != null
159159
? task.annotations!
160160
.map((a) => {"entry": a.entry, "description": a.description})
@@ -192,7 +192,7 @@ class TaskDatabase {
192192
);
193193

194194
if (maps.isNotEmpty) {
195-
return getObjectForTask(maps.first);
195+
return await getObjectForTask(maps.first);
196196
} else {
197197
return null;
198198
}
@@ -249,6 +249,10 @@ class TaskDatabase {
249249
whereArgs: [uuid],
250250
);
251251
debugPrint('task${uuid}edited');
252+
if (newTags.isNotEmpty) {
253+
TaskForC? task = await getTaskByUuid(uuid);
254+
await setTagsForTask(uuid, task?.id ?? 0, newTags.toList());
255+
}
252256
}
253257

254258
Future<List<TaskForC>> findTasksWithoutUUIDs() async {
@@ -332,6 +336,7 @@ class TaskDatabase {
332336

333337
// Set tags using a composite key
334338
Future<void> setTagsForTask(String uuid, int id, List<String> tags) async {
339+
debugPrint('Setting tags for task $uuid: $tags');
335340
try {
336341
ensureDatabaseIsOpen();
337342
final db = _database;

0 commit comments

Comments
 (0)