From: Eduardo Date: Mon, 2 Oct 2023 12:34:38 +0000 (+0200) Subject: default order for tasks X-Git-Url: http://git.edufdez.es/?a=commitdiff_plain;h=f04637d59a5b585ee290db56922eea25e18fecbc;p=The%20Cutests%20To-Do%20List.git default order for tasks --- 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: