aboutsummaryrefslogtreecommitdiff
path: root/QSThingsPlugin/Handlers/ThingsTaskHandler.m
diff options
context:
space:
mode:
authorRuben Beltran del Rio <git@r.bdr.sh>2025-09-12 22:01:42 +0200
committerRuben Beltran del Rio <git@r.bdr.sh>2025-09-12 22:01:42 +0200
commite25ea7404caa25148d8b9084daf98c098102fe14 (patch)
tree846fde0b8fc2748c918b34117881b46a67b7a8aa /QSThingsPlugin/Handlers/ThingsTaskHandler.m
parent182872c760d437556d606cc02c6b7c570667a715 (diff)
Add project tasks that are under headings1.0.0
Diffstat (limited to 'QSThingsPlugin/Handlers/ThingsTaskHandler.m')
-rw-r--r--QSThingsPlugin/Handlers/ThingsTaskHandler.m27
1 files changed, 27 insertions, 0 deletions
diff --git a/QSThingsPlugin/Handlers/ThingsTaskHandler.m b/QSThingsPlugin/Handlers/ThingsTaskHandler.m
index 5875feb..406e5ab 100644
--- a/QSThingsPlugin/Handlers/ThingsTaskHandler.m
+++ b/QSThingsPlugin/Handlers/ThingsTaskHandler.m
@@ -55,6 +55,7 @@ NS_ASSUME_NONNULL_BEGIN
if (object.primaryType == kProjectType) {
[children addObjectsFromArray:[self tasksForTaskIdentifiedBy:uuid usingDatabaseAt:path ]];
+ [children addObjectsFromArray:[self tasksInHeadingsForTaskIdentifiedBy:uuid usingDatabaseAt:path ]];
} else {
[children addObjectsFromArray:[self projectsForTaskIdentifiedBy:uuid usingDatabaseAt:path ]];
}
@@ -160,6 +161,32 @@ NS_ASSUME_NONNULL_BEGIN
return objects;
}
+- (NSArray *)tasksInHeadingsForTaskIdentifiedBy:(NSString *)uuid usingDatabaseAt:(NSString *)path {
+ NSString *query = [NSString stringWithFormat: @"SELECT "
+ "task.uuid as uuid, "
+ "task.creationDate as creationDate, "
+ "task.status as status, "
+ "task.title as title, "
+ "task.notes as notes, "
+ "task.area as area "
+ "FROM TMTask AS heading "
+ "LEFT JOIN TMTask AS task "
+ "ON task.heading = heading.uuid "
+ "WHERE heading.project = '%@' "
+ "AND task.type = 0 "
+ "AND task.trashed = 0 "
+ "AND task.status = 0 "
+ "ORDER BY task.title;", uuid];
+
+ NSArray *results = [SQLHelper executeSql:query onFile:path];
+ NSMutableArray *objects = [NSMutableArray array];
+ [results enumerateObjectsUsingBlock:^(NSDictionary *dictionary, NSUInteger i, BOOL *stop) {
+ [objects addObject:[ObjectHelper taskFromSQLResult:dictionary usingPath:path ]];
+ }];
+
+ return objects;
+}
+
@end
NS_ASSUME_NONNULL_END