From 0a52e3a5f7de1cecccd4c95aa588b64091cb1f6c Mon Sep 17 00:00:00 2001 From: maxpozdeev Date: Sun, 10 Sep 2023 18:57:29 +0300 Subject: [PATCH] * counter of new tasks shows only open tasks (excluding completed) --- src/content/mytinytodo.js | 1 + src/includes/api/TasksController.php | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/content/mytinytodo.js b/src/content/mytinytodo.js index 9246150..3968c43 100644 --- a/src/content/mytinytodo.js +++ b/src/content/mytinytodo.js @@ -2710,6 +2710,7 @@ function newTaskCounter() const params = { list: curList.id, later: curList.lastTime, + showCompl: curList.showCompl, lists: [], }; tabLists.getAll().forEach( (list) => { diff --git a/src/includes/api/TasksController.php b/src/includes/api/TasksController.php index ad6aa6b..8025144 100644 --- a/src/includes/api/TasksController.php +++ b/src/includes/api/TasksController.php @@ -279,7 +279,7 @@ class TasksController extends ApiController { if (!isset($item['later'])) continue; $later = (int)$item['later']; if ($later <= 0) continue; - $sqlWhereList[] = "(list_id = ". (int)$item['listId']. " AND d_created > $later)"; + $sqlWhereList[] = "(list_id = ". (int)$item['listId']. " AND compl=0 AND d_created > $later)"; } $sqlWhere = implode(' OR ', $sqlWhereList); @@ -300,7 +300,7 @@ class TasksController extends ApiController { $later = (int) ($this->req->jsonBody['later'] ?? 0); if ($list > 0 && $later > 0 && (!$userLists || in_array((string)$list, $userLists))) { $q = $db->dq("SELECT id FROM {$db->prefix}todolist - WHERE list_id = $list AND d_created > $later"); + WHERE list_id = $list AND compl=0 AND d_created > $later"); while ($r = $q->fetchAssoc()) { $b[] = (int)$r['id']; }