Bug Fix - limit:

- The limit: attribute can now be specified on the command line, to
  override any custom report filter.
This commit is contained in:
Paul Beckingham 2009-06-18 18:34:40 -04:00
parent af606598fa
commit b9a1993692
5 changed files with 14 additions and 25 deletions

View file

@ -187,20 +187,6 @@ bool Att::valid (const std::string& input) const
return false;
}
////////////////////////////////////////////////////////////////////////////////
// TODO Obsolete
bool Att::validName (const std::string& name)
{
if (validModifiableName (name))
return true;
for (unsigned int i = 0; i < NUM_INTERNAL_NAMES; ++i)
if (name == internalNames[i])
return true;
return false;
}
////////////////////////////////////////////////////////////////////////////////
bool Att::validModifiableName (const std::string& name)
{

View file

@ -44,7 +44,6 @@ public:
~Att ();
bool valid (const std::string&) const;
static bool validName (const std::string&);
static bool validModifiableName (const std::string&);
static bool validNameValue (const std::string&, const std::string&, const std::string&);
static bool validNameValue (std::string&, std::string&, std::string&);

View file

@ -162,8 +162,7 @@ void Config::createDefault (const std::string& home)
fprintf (out, "# description_only\n"); // TODO i18n
fprintf (out, "# Description: This report is ...\n"); // TODO i18n
fprintf (out, "# Sort: due+,priority-,project+\n"); // TODO i18n
fprintf (out, "# Filter: pro:x pri:H +bug\n"); // TODO i18n
fprintf (out, "# Limit: 10\n"); // TODO i18n
fprintf (out, "# Filter: pro:x pri:H +bug limit:10\n"); // TODO i18n
fprintf (out, "report.long.description=Lists all task, all data, matching the specified criteria\n"); // TODO i18n
fprintf (out, "report.long.columns=id,project,priority,entry,start,due,recur,age,tags,description\n"); // TODO i18n

View file

@ -539,6 +539,12 @@ void Context::autoFilter (Task& t, Filter& f)
header ("auto filter: " + att->first + ".startswith:" + att->second.value ());
}
// The limit attribute does not participate in filtering, and needs to be
// specifically handled in handleCustomReport.
else if (att->first == "limit")
{
}
// Every task has a unique uuid by default, and it shouldn't be included.
// The mechanism for filtering on tags is +/-<tag>, not tags:foo which
// means that there can only be one tag, "foo".

View file

@ -90,6 +90,10 @@ std::string handleCustomReport (const std::string& report)
context.sequence.combine (sequence);
// Allow limit to be overridden by the command line.
if (!context.task.has ("limit") && task.has ("limit"))
context.task.set ("limit", task.get ("limit"));
foreach (att, filter)
context.filter.push_back (*att);
}
@ -462,15 +466,10 @@ std::string handleCustomReport (const std::string& report)
// Limit the number of rows according to the report definition.
int maximum = context.config.get (std::string ("report.") + report + ".limit", (int)0);
// If the custom report has a defined limit, then allow an override, which
// will show up as a single ID sequence.
// If the custom report has a defined limit, then allow a numeric override.
// This is an integer specified on the command line (task oldest 4), which is
// parsed as an ID.
if (context.config.get (std::string ("report.") + report + ".limit", (int)0) != 0)
if (context.sequence.size () == 1)
maximum = context.sequence[0];
// This is an integer specified as a filter (limit:10).
if (context.task.has ("limit"))
maximum = ::atoi (context.task.get ("limit").c_str ());
std::stringstream out;
if (table.rowCount ())