- 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:
Paul Beckingham 2011-05-13 17:54:08 -04:00
parent 6fb3bc5b03
commit 3d69f70d66
2 changed files with 15 additions and 11 deletions

View file

@ -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)
{
}
@ -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;

View file

@ -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;