mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
Bug
- Lack of Task default constructor, copy constructor and operator= implementation details caused tasks stored in an STL container to lose their cached urgency value. - Info report now specifically formats urgency values, whereas the default formatting adds justification spacing.
This commit is contained in:
parent
6fb3bc5b03
commit
3d69f70d66
2 changed files with 15 additions and 11 deletions
16
src/Task.cpp
16
src/Task.cpp
|
@ -25,6 +25,7 @@
|
|||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <iostream> // TODO Remove
|
||||
#include <sstream>
|
||||
#include <algorithm>
|
||||
#include <Context.h>
|
||||
|
@ -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)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -61,6 +64,8 @@ Task& Task::operator= (const Task& other)
|
|||
{
|
||||
Record::operator= (other);
|
||||
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,8 +921,7 @@ float Task::urgency ()
|
|||
// urgency.project.coefficient
|
||||
coefficient = context.config.getReal ("urgency.project.coefficient");
|
||||
|
||||
value = get ("project");
|
||||
if (value != "") term = 1.0;
|
||||
if (has ("project")) term = 1.0;
|
||||
else term = 0.0;
|
||||
|
||||
urgency_value += term * coefficient;
|
||||
|
@ -923,8 +929,7 @@ float Task::urgency ()
|
|||
// urgency.active.coefficient
|
||||
coefficient = context.config.getReal ("urgency.active.coefficient");
|
||||
|
||||
value = get ("start");
|
||||
if (value != "") term = 1.0;
|
||||
if (has ("start")) term = 1.0;
|
||||
else term = 0.0;
|
||||
|
||||
urgency_value += term * coefficient;
|
||||
|
@ -941,8 +946,7 @@ float Task::urgency ()
|
|||
// urgency.blocked.coefficient
|
||||
coefficient = context.config.getReal ("urgency.blocked.coefficient");
|
||||
|
||||
value = get ("depends");
|
||||
if (value != "") term = 1.0;
|
||||
if (has ("depends")) term = 1.0;
|
||||
else term = 0.0;
|
||||
|
||||
urgency_value += term * coefficient;
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue