Bug Fix - Calendar

- Fixed bug in calendar that failed to consider only pending tasks
  when coloring in the calendar display, and when calculating the
  most overdue task to be displayed.
- Modified util.cpp/formatSeconds to stop displaying fractional days,
  because having a task age represented as 5.1 days is silly.
This commit is contained in:
Paul Beckingham 2009-06-22 16:58:44 -04:00
parent a4f9493ce7
commit 62449d8b3e
2 changed files with 22 additions and 19 deletions

View file

@ -1479,18 +1479,21 @@ std::string renderMonths (
today.year () == years.at (mpl))
table.setCellFg (row, thisCol, Text::cyan);
std::vector <Task>::iterator it;
for (it = all.begin (); it != all.end (); ++it)
foreach (task, all)
{
Date due (::atoi (it->get ("due").c_str ()));
if ((context.config.get ("color", true) || context.config.get (std::string ("_forcecolor"), false)) &&
due.day () == d &&
due.month () == months.at (mpl) &&
due.year () == years.at (mpl))
if (task->getStatus () == Task::pending &&
task->has ("due"))
{
table.setCellFg (row, thisCol, Text::black);
table.setCellBg (row, thisCol, due < today ? Text::on_red : Text::on_yellow);
Date due (::atoi (task->get ("due").c_str ()));
if ((context.config.get ("color", true) || context.config.get (std::string ("_forcecolor"), false)) &&
due.day () == d &&
due.month () == months.at (mpl) &&
due.year () == years.at (mpl))
{
table.setCellFg (row, thisCol, Text::black);
table.setCellBg (row, thisCol, due < today ? Text::on_red : Text::on_yellow);
}
}
}
@ -1532,12 +1535,15 @@ std::string handleReportCalendar ()
Date newest;
foreach (task, tasks)
{
if (task->has ("due"))
if (task->getStatus () == Task::pending)
{
Date d (::atoi (task->get ("due").c_str ()));
if (task->has ("due"))
{
Date d (::atoi (task->get ("due").c_str ()));
if (d < oldest) oldest = d;
if (d > newest) newest = d;
if (d < oldest) oldest = d;
if (d > newest) newest = d;
}
}
}