Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show completion percentage after summary #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions MMM-NextCloud-Tasks.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 += " <i>(" + element.completion + "%)</i>";
}

if (typeof element.children !== "undefined") {
let childList = self.renderList(element.children);
Expand Down Expand Up @@ -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");
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ var config = {
hideCompletedTasks: true,
sortMethod: "<SORT_METHOD>",
colorize: true,
showCompletion: true,
webDavAuth: {
username: "<NEXTCLOUD_APP_USERNAME>",
password: "<NEXTCLOUD_APP_PASSWORD>",
Expand All @@ -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

Expand Down