blob: c07d7d150c66c924e2dcb7a0218c332305c4b970 (
plain) (
tree)
|
|
class_name Task
class Task_data:
var id
var name
var description
var frequency
var estimated_length
var date_completed
func _init(record):
self.id = record['id']
self.name = record['name']
self.description = record['description']
self.frequency = record['frequency']
self.estimated_length = record['estimated_length']
self.date_completed = record['date_completed']
static func get_by_id(id):
var record = DBMS.query("""
SELECT * FROM "Tasks"
WHERE id = ?
""",
[id])
record = record[0]
return Task_data.new(record)
static func get_by_timeslot(timeslot_id):
var records = DBMS.query("""
SELECT "Tasks".* FROM "Tasks"
INNER JOIN "TimeSlotTasks" ON "Tasks".id = "TimeSlotTasks".task_id
WHERE "TimeSlotTasks".timeslot_id = ?
""",
[timeslot_id])
var tasks = []
for record in records:
tasks.push_back(Task_data.new(record))
return tasks
static func get_by_frequency(frequency):
var records = DBMS.query("""
SELECT * FROM "Tasks"
WHERE frequency = ?
""",
[frequency])
var tasks = []
for record in records:
tasks.push_back(Task_data.new(record))
return tasks
|