From 6b83945a21f249325dd715bcefe7c199b1bd64b5 Mon Sep 17 00:00:00 2001 From: Tomas Babej Date: Tue, 1 Sep 2015 22:13:42 +0200 Subject: [PATCH] Urgency: Replace 'next' coefficient with configuration entry --- src/Config.cpp | 2 +- src/Context.cpp | 1 - src/Task.cpp | 11 ----------- src/Task.h | 2 -- src/commands/CmdInfo.cpp | 1 - test/urgency.t | 2 +- 6 files changed, 2 insertions(+), 17 deletions(-) diff --git a/src/Config.cpp b/src/Config.cpp index e4c247c7b..19611c4bc 100644 --- a/src/Config.cpp +++ b/src/Config.cpp @@ -140,7 +140,7 @@ std::string Config::_defaults = "dependency.confirmation=on # Should dependency chain repair be confirmed?\n" "\n" "# Urgency Coefficients\n" - "urgency.next.coefficient=15.0 # Urgency coefficient for 'next' special tag\n" + "urgency.user.tag.next.coefficient=15.0 # Urgency coefficient for 'next' special tag\n" "urgency.due.coefficient=12.0 # Urgency coefficient for due dates\n" "urgency.blocking.coefficient=8.0 # Urgency coefficient for blocking tasks\n" "urgency.active.coefficient=4.0 # Urgency coefficient for active tasks\n" diff --git a/src/Context.cpp b/src/Context.cpp index b763606a9..a9dca694d 100644 --- a/src/Context.cpp +++ b/src/Context.cpp @@ -658,7 +658,6 @@ void Context::staticInitialization () Task::urgencyBlockedCoefficient = config.getReal ("urgency.blocked.coefficient"); Task::urgencyAnnotationsCoefficient = config.getReal ("urgency.annotations.coefficient"); Task::urgencyTagsCoefficient = config.getReal ("urgency.tags.coefficient"); - Task::urgencyNextCoefficient = config.getReal ("urgency.next.coefficient"); Task::urgencyDueCoefficient = config.getReal ("urgency.due.coefficient"); Task::urgencyBlockingCoefficient = config.getReal ("urgency.blocking.coefficient"); Task::urgencyAgeCoefficient = config.getReal ("urgency.age.coefficient"); diff --git a/src/Task.cpp b/src/Task.cpp index ff3725a8b..d49b8b641 100644 --- a/src/Task.cpp +++ b/src/Task.cpp @@ -80,7 +80,6 @@ float Task::urgencyWaitingCoefficient = 0.0; float Task::urgencyBlockedCoefficient = 0.0; float Task::urgencyAnnotationsCoefficient = 0.0; float Task::urgencyTagsCoefficient = 0.0; -float Task::urgencyNextCoefficient = 0.0; float Task::urgencyDueCoefficient = 0.0; float Task::urgencyBlockingCoefficient = 0.0; float Task::urgencyAgeCoefficient = 0.0; @@ -1715,7 +1714,6 @@ float Task::urgency_c () const value += fabsf (Task::urgencyBlockedCoefficient) > epsilon ? (urgency_blocked () * Task::urgencyBlockedCoefficient) : 0.0; value += fabsf (Task::urgencyAnnotationsCoefficient) > epsilon ? (urgency_annotations () * Task::urgencyAnnotationsCoefficient) : 0.0; value += fabsf (Task::urgencyTagsCoefficient) > epsilon ? (urgency_tags () * Task::urgencyTagsCoefficient) : 0.0; - value += fabsf (Task::urgencyNextCoefficient) > epsilon ? (urgency_next () * Task::urgencyNextCoefficient) : 0.0; value += fabsf (Task::urgencyDueCoefficient) > epsilon ? (urgency_due () * Task::urgencyDueCoefficient) : 0.0; value += fabsf (Task::urgencyBlockingCoefficient) > epsilon ? (urgency_blocking () * Task::urgencyBlockingCoefficient) : 0.0; value += fabsf (Task::urgencyAgeCoefficient) > epsilon ? (urgency_age () * Task::urgencyAgeCoefficient) : 0.0; @@ -1900,15 +1898,6 @@ float Task::urgency_tags () const } } -//////////////////////////////////////////////////////////////////////////////// -float Task::urgency_next () const -{ - if (hasTag ("next")) - return 1.0; - - return 0.0; -} - //////////////////////////////////////////////////////////////////////////////// // // Past Present Future diff --git a/src/Task.h b/src/Task.h index 081ad4919..7776f7ad0 100644 --- a/src/Task.h +++ b/src/Task.h @@ -51,7 +51,6 @@ public: static float urgencyBlockedCoefficient; static float urgencyAnnotationsCoefficient; static float urgencyTagsCoefficient; - static float urgencyNextCoefficient; static float urgencyDueCoefficient; static float urgencyBlockingCoefficient; static float urgencyAgeCoefficient; @@ -174,7 +173,6 @@ public: float urgency_inherit () const; float urgency_annotations () const; float urgency_tags () const; - float urgency_next () const; float urgency_due () const; float urgency_blocking () const; float urgency_age () const; diff --git a/src/commands/CmdInfo.cpp b/src/commands/CmdInfo.cpp index 537a63810..3066ac563 100644 --- a/src/commands/CmdInfo.cpp +++ b/src/commands/CmdInfo.cpp @@ -432,7 +432,6 @@ int CmdInfo::execute (std::string& output) urgencyTerm (urgencyDetails, "blocking", task.urgency_blocking (), Task::urgencyBlockingCoefficient); urgencyTerm (urgencyDetails, "annotations", task.urgency_annotations (), Task::urgencyAnnotationsCoefficient); urgencyTerm (urgencyDetails, "tags", task.urgency_tags (), Task::urgencyTagsCoefficient); - urgencyTerm (urgencyDetails, "next", task.urgency_next (), Task::urgencyNextCoefficient); urgencyTerm (urgencyDetails, "due", task.urgency_due (), Task::urgencyDueCoefficient); urgencyTerm (urgencyDetails, "age", task.urgency_age (), Task::urgencyAgeCoefficient); diff --git a/test/urgency.t b/test/urgency.t index ae2762a0d..0def637ef 100755 --- a/test/urgency.t +++ b/test/urgency.t @@ -51,7 +51,7 @@ class TestUrgency(TestCase): cls.t.config("urgency.annotations.coefficient", "10") cls.t.config("urgency.tags.coefficient", "10") cls.t.config("urgency.waiting.coefficient", "-10") - cls.t.config("urgency.next.coefficient", "10") + cls.t.config("urgency.user.tag.next.coefficient", "10") cls.t.config("urgency.user.project.PROJECT.coefficient", "10") cls.t.config("urgency.user.tag.TAG.coefficient", "10") cls.t.config("confirmation", "off")