From 392a0e4bf6f3af75e114ea92f3dd920854c1d331 Mon Sep 17 00:00:00 2001 From: Schengawegga Date: Mon, 15 Apr 2024 20:55:54 +0200 Subject: [PATCH] Show completion percentage after summary --- MMM-NextCloud-Tasks.js | 10 ++++++++-- README.md | 2 ++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/MMM-NextCloud-Tasks.js b/MMM-NextCloud-Tasks.js index 665f00c..d230b6f 100755 --- a/MMM-NextCloud-Tasks.js +++ b/MMM-NextCloud-Tasks.js @@ -12,7 +12,8 @@ Module.register("MMM-NextCloud-Tasks", { updateInterval: 60000, hideCompletedTasks: true, sortMethod: "priority", - colorize: false + colorize: false, + showCompletion: false }, requiresVersion: "2.1.0", // Required version of MagicMirror @@ -101,6 +102,10 @@ Module.register("MMM-NextCloud-Tasks", { } else { li.innerHTML = icon + " " + element.summary; } + + if (typeof element.completion !== "undefined" && self.config.showCompletion === true) { + li.innerHTML += " (" + element.completion + "%)"; + } if (typeof element.children !== "undefined") { let childList = self.renderList(element.children); @@ -140,7 +145,8 @@ Module.register("MMM-NextCloud-Tasks", { typeof config.webDavAuth.username === "undefined" || typeof config.webDavAuth.password === "undefined" || typeof config.sortMethod === "undefined" || - typeof config.colorize === "undefined" + typeof config.colorize === "undefined" || + typeof config.showCompletion === "undefined" ) { this.error = "Config variable missing"; Log.error("Config variable missing"); diff --git a/README.md b/README.md index 829aaa0..0392d40 100755 --- a/README.md +++ b/README.md @@ -42,6 +42,7 @@ var config = { hideCompletedTasks: true, sortMethod: "", colorize: true, + showCompletion: true, webDavAuth: { username: "", password: "", @@ -62,6 +63,7 @@ var config = { | `hideCompletedTasks` | *Optional*: should completed tasks show up or not | `sortMethod` | *Optional*: How to sort tasks. Options: "priority" "priority desc" "created" "created desc" "modified" "modified desc" | `colorize` | *Optional*: Should the icons be colorized based on priority? +| `showCompletion` | *Optional*: Shows the percentage of completion ## Screenshots