Commit aa10aa45 authored by ransome1's avatar ransome1
Browse files

Preserve priority when complete

parent 2ca6e9ae
{ {
"name": "sleek", "name": "sleek",
"productName": "sleek", "productName": "sleek",
"version": "1.1.2-rc.4", "version": "1.1.2",
"description": "Todo app based on todo.txt for Linux, Windows and MacOS, free and open-source", "description": "Todo app based on todo.txt for Linux, Windows and MacOS, free and open-source",
"synopsis": "Todo app based on todo.txt for Linux, Windows and MacOS, free and open-source", "synopsis": "Todo app based on todo.txt for Linux, Windows and MacOS, free and open-source",
"category": "ProjectManagement", "category": "ProjectManagement",
......
name: sleek name: sleek
base: core18 base: core18
version: '1.1.1' version: '1.1.2'
summary: Todo app based on the todo.txt format for Linux, free and open-source summary: Todo app based on the todo.txt format for Linux, free and open-source
description: | description: |
sleek is an open-source todo app that makes use of the todo.txt format. sleeks GUI is modern and simple but still offers a decent set of functions which help users getting things done. sleek is available as a client for Windows, MacOS and Linux. sleek is an open-source todo app that makes use of the todo.txt format. sleeks GUI is modern and simple but still offers a decent set of functions which help users getting things done. sleek is available as a client for Windows, MacOS and Linux.
......
...@@ -441,7 +441,7 @@ function setTodoComplete(todo) { ...@@ -441,7 +441,7 @@ function setTodoComplete(todo) {
todo.complete = false; todo.complete = false;
todo.completed = null; todo.completed = null;
// delete old item from array and add the new one at it's position // delete old item from array and add the new one at it's position
items.objects.splice(index, 1, todo); //items.objects.splice(index, 1, todo);
// Mark item as complete // Mark item as complete
} else if(!todo.complete) { } else if(!todo.complete) {
if(todo.due) { if(todo.due) {
...@@ -457,13 +457,18 @@ function setTodoComplete(todo) { ...@@ -457,13 +457,18 @@ function setTodoComplete(todo) {
} }
todo.complete = true; todo.complete = true;
todo.completed = new Date(); todo.completed = new Date();
// delete old todo from array and add the new one at it's position
items.objects.splice(index, 1, todo);
// if recurrence is set start generating the recurring todo // if recurrence is set start generating the recurring todo
if(todo.rec) generateRecurrence(todo) if(todo.rec) generateRecurrence(todo)
// finally remove priority if(todo.priority) {
todo.priority = null; // and preserve prio
todo.text += " pri:" + todo.priority
// finally remove priority
todo.priority = null;
}
} }
// delete old todo from array and add the new one at it's position
items.objects.splice(index, 1, todo);
//write the data to the file //write the data to the file
window.api.send("writeToFile", [items.objects.join("\n").toString() + "\n"]); window.api.send("writeToFile", [items.objects.join("\n").toString() + "\n"]);
return Promise.resolve("Success: Changes written to file: " + getActiveFile()); return Promise.resolve("Success: Changes written to file: " + getActiveFile());
......
...@@ -713,7 +713,7 @@ const createWindow = async function() { ...@@ -713,7 +713,7 @@ const createWindow = async function() {
file = args[1]; file = args[1];
} }
// Write content to file // Write content to file
if(file) fs.writeFileSync(file, args [0], {encoding: "utf-8"}); if(file) fs.writeFileSync(file, args[0], {encoding: "utf-8"});
} catch(error) { } catch(error) {
console.error(error); console.error(error);
error.functionName = "fs.writeFileSync"; error.functionName = "fs.writeFileSync";
...@@ -789,7 +789,7 @@ const createWindow = async function() { ...@@ -789,7 +789,7 @@ const createWindow = async function() {
console.error(error); console.error(error);
}); });
} }
}, 60000); }, 600000);
} }
// ######################################################################################################################## // ########################################################################################################################
// APP EVENTS // APP EVENTS
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment