diff --git a/src/Task.cpp b/src/Task.cpp index 460d2ccdc..fb263d676 100644 --- a/src/Task.cpp +++ b/src/Task.cpp @@ -25,6 +25,7 @@ // //////////////////////////////////////////////////////////////////////////////// +#include // TODO Remove #include #include #include @@ -51,6 +52,8 @@ Task::Task () Task::Task (const Task& other) : Record (other) , id (other.id) +, urgency_value (other.urgency_value) +, recalc_urgency (other.recalc_urgency) { } @@ -60,7 +63,9 @@ Task& Task::operator= (const Task& other) if (this != &other) { Record::operator= (other); - id = other.id; + id = other.id; + urgency_value = other.urgency_value; + recalc_urgency = other.recalc_urgency; } return *this; @@ -85,6 +90,8 @@ bool Task::operator== (const Task& other) Task::Task (const std::string& input) { id = 0; + urgency_value = 0.0; + recalc_urgency = true; parse (input); } @@ -914,18 +921,16 @@ float Task::urgency () // urgency.project.coefficient coefficient = context.config.getReal ("urgency.project.coefficient"); - value = get ("project"); - if (value != "") term = 1.0; - else term = 0.0; + if (has ("project")) term = 1.0; + else term = 0.0; urgency_value += term * coefficient; // urgency.active.coefficient coefficient = context.config.getReal ("urgency.active.coefficient"); - value = get ("start"); - if (value != "") term = 1.0; - else term = 0.0; + if (has ("start")) term = 1.0; + else term = 0.0; urgency_value += term * coefficient; @@ -941,9 +946,8 @@ float Task::urgency () // urgency.blocked.coefficient coefficient = context.config.getReal ("urgency.blocked.coefficient"); - value = get ("depends"); - if (value != "") term = 1.0; - else term = 0.0; + if (has ("depends")) term = 1.0; + else term = 0.0; urgency_value += term * coefficient; diff --git a/src/report.cpp b/src/report.cpp index afa598a1c..ba02f2a22 100644 --- a/src/report.cpp +++ b/src/report.cpp @@ -619,7 +619,7 @@ int handleInfo (std::string& outs) // Task::urgency row = view.addRow (); view.set (row, 0, "Urgency"); - view.set (row, 1, task->urgency ()); + view.set (row, 1, trimLeft (format (task->urgency (), 4, 4))); // Create a second table, containing undo log change details. ViewText journal;