summaryrefslogtreecommitdiffstats
path: root/data_model/SubTask.gd
blob: ffb4d2e946c55c7a830908963b099e5da6d46592 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
class_name SubTask

class SubTask_data:
    var id
    var task_id
    var name
    var date_completed

    func _init(record):
        self.id = record['id']
        self.task_id = record['task_id']
        self.name = record['name']
        self.date_completed = record['date_completed']

static func get_by_task(task_id):
    var records = DBMS.query("""
            SELECT * FROM "SubTasks"
            WHERE task_id = ?
        """,
        [task_id])
    var subtasks = []
    for record in records:
        subtasks.push_back(SubTask_data.new(record))
    return subtasks