From f04637d59a5b585ee290db56922eea25e18fecbc Mon Sep 17 00:00:00 2001 From: Eduardo Date: Mon, 2 Oct 2023 14:34:38 +0200 Subject: [PATCH] default order for tasks --- singletons/database_dao.gd | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/singletons/database_dao.gd b/singletons/database_dao.gd index 1c25101..32e458a 100644 --- a/singletons/database_dao.gd +++ b/singletons/database_dao.gd @@ -39,11 +39,11 @@ func instanciate(): func get_todo_tasks(done = null) -> Array[Dictionary]: var query := "SELECT rowid, task, done, position, priority FROM todo" if done: - query += " WHERE done = 1;" + query += " WHERE done = 1" elif done == false: - query += " WHERE done = 0;" - else: - query += ";" + query += " WHERE done = 0" + + query += " ORDER BY priority DESC;" var success := _get_instance().query(query) if success: @@ -123,6 +123,8 @@ func _migrate(): var success := _db.query("SELECT value FROM metadata WHERE key = 'version';") if success: current_version = int(_db.query_result[0]["value"]) + else: + printerr("This is normal as there is no database right now, creating it.") if current_version < DB_VERSION: while current_version < DB_VERSION: -- 2.30.2