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
24
src/Task.cpp
24
src/Task.cpp
|
@ -25,6 +25,7 @@
|
||||||
//
|
//
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#include <iostream> // TODO Remove
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <Context.h>
|
#include <Context.h>
|
||||||
|
@ -51,6 +52,8 @@ Task::Task ()
|
||||||
Task::Task (const Task& other)
|
Task::Task (const Task& other)
|
||||||
: Record (other)
|
: Record (other)
|
||||||
, id (other.id)
|
, 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)
|
if (this != &other)
|
||||||
{
|
{
|
||||||
Record::operator= (other);
|
Record::operator= (other);
|
||||||
id = other.id;
|
id = other.id;
|
||||||
|
urgency_value = other.urgency_value;
|
||||||
|
recalc_urgency = other.recalc_urgency;
|
||||||
}
|
}
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
|
@ -85,6 +90,8 @@ bool Task::operator== (const Task& other)
|
||||||
Task::Task (const std::string& input)
|
Task::Task (const std::string& input)
|
||||||
{
|
{
|
||||||
id = 0;
|
id = 0;
|
||||||
|
urgency_value = 0.0;
|
||||||
|
recalc_urgency = true;
|
||||||
parse (input);
|
parse (input);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -914,18 +921,16 @@ float Task::urgency ()
|
||||||
// urgency.project.coefficient
|
// urgency.project.coefficient
|
||||||
coefficient = context.config.getReal ("urgency.project.coefficient");
|
coefficient = context.config.getReal ("urgency.project.coefficient");
|
||||||
|
|
||||||
value = get ("project");
|
if (has ("project")) term = 1.0;
|
||||||
if (value != "") term = 1.0;
|
else term = 0.0;
|
||||||
else term = 0.0;
|
|
||||||
|
|
||||||
urgency_value += term * coefficient;
|
urgency_value += term * coefficient;
|
||||||
|
|
||||||
// urgency.active.coefficient
|
// urgency.active.coefficient
|
||||||
coefficient = context.config.getReal ("urgency.active.coefficient");
|
coefficient = context.config.getReal ("urgency.active.coefficient");
|
||||||
|
|
||||||
value = get ("start");
|
if (has ("start")) term = 1.0;
|
||||||
if (value != "") term = 1.0;
|
else term = 0.0;
|
||||||
else term = 0.0;
|
|
||||||
|
|
||||||
urgency_value += term * coefficient;
|
urgency_value += term * coefficient;
|
||||||
|
|
||||||
|
@ -941,9 +946,8 @@ float Task::urgency ()
|
||||||
// urgency.blocked.coefficient
|
// urgency.blocked.coefficient
|
||||||
coefficient = context.config.getReal ("urgency.blocked.coefficient");
|
coefficient = context.config.getReal ("urgency.blocked.coefficient");
|
||||||
|
|
||||||
value = get ("depends");
|
if (has ("depends")) term = 1.0;
|
||||||
if (value != "") term = 1.0;
|
else term = 0.0;
|
||||||
else term = 0.0;
|
|
||||||
|
|
||||||
urgency_value += term * coefficient;
|
urgency_value += term * coefficient;
|
||||||
|
|
||||||
|
|
|
@ -619,7 +619,7 @@ int handleInfo (std::string& outs)
|
||||||
// Task::urgency
|
// Task::urgency
|
||||||
row = view.addRow ();
|
row = view.addRow ();
|
||||||
view.set (row, 0, "Urgency");
|
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.
|
// Create a second table, containing undo log change details.
|
||||||
ViewText journal;
|
ViewText journal;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue