Urgency/next

- Added 'urgency' as a reportable, sortable column.  This will allow
  us to test the urgency coefficients.  Note that this is experimental,
  and as such will not be documented.
This commit is contained in:
Paul Beckingham 2010-12-30 22:20:33 -05:00
parent 77f3269f09
commit 1b66904550
2 changed files with 20 additions and 2 deletions

View file

@ -53,6 +53,7 @@ static const char* internalNames[] =
"status", "status",
"description", "description",
"tags", "tags",
"urgency",
// Note that annotations are not listed. // Note that annotations are not listed.
}; };
@ -465,7 +466,8 @@ std::string Att::type (const std::string& name) const
else if (name == "recur") else if (name == "recur")
return "duration"; return "duration";
else if (name == "limit") else if (name == "limit" ||
name == "urgency")
return "number"; return "number";
else if (name == "priority") else if (name == "priority")

View file

@ -541,6 +541,21 @@ int handleCustomReport (const std::string& report, std::string& outs)
} }
} }
else if (*col == "urgency")
{
table.addColumn (columnLabels[*col] != "" ? columnLabels[*col] : "Urgency");
table.setColumnWidth (columnCount, Table::minimum);
table.setColumnJustification (columnCount, Table::right);
int row = 0;
foreach (task, tasks)
{
std::string value = format (task->urgency (), 1, 3);
context.hooks.trigger ("format-urgency", "urgency", value);
table.addCell (row++, columnCount, value);
}
}
// Common to all columns. // Common to all columns.
// Add underline. // Add underline.
if ((context.config.getBoolean ("color") || context.config.getBoolean ("_forcecolor")) && if ((context.config.getBoolean ("color") || context.config.getBoolean ("_forcecolor")) &&
@ -712,7 +727,8 @@ void validReportColumns (const std::vector <std::string>& columns)
*it != "description_only" && *it != "description_only" &&
*it != "description" && *it != "description" &&
*it != "wait" && *it != "wait" &&
*it != "depends") *it != "depends" &&
*it != "urgency")
bad.push_back (*it); bad.push_back (*it);
if (bad.size ()) if (bad.size ())