Code Cleanup

- The "next" command had two control paths.  One was via custom reports
  (correct) and the other was a residual handler (obsolete), which is
  now removed.  This also simplifies a handleCustomReport/runCustomReport
  issue.
This commit is contained in:
Paul Beckingham 2010-07-11 12:50:41 -04:00
parent 307027a1d9
commit 254b418708
3 changed files with 1 additions and 71 deletions

View file

@ -251,8 +251,7 @@ int Context::dispatch (std::string &out)
else if (cmd.command == "" &&
sequence.size ()) { rc = handleModify (out); }
// Command that display IDs and therefore need TDB::gc first.
else if (cmd.command == "next") { if (!inShadow) tdb.gc (); rc = handleReportNext (out); }
// Commands that display IDs and therefore need TDB::gc first.
else if (cmd.validCustom (cmd.command)) { if (!inShadow) tdb.gc (); rc = handleCustomReport (cmd.command, out); }
// If the command is not recognized, display usage.

View file

@ -99,7 +99,6 @@ int shortUsage (std::string &);
int longUsage (std::string &);
int handleInfo (std::string &);
int handleReportSummary (std::string &);
int handleReportNext (std::string &);
int handleReportHistoryMonthly (std::string &);
int handleReportHistoryAnnual (std::string &);
int handleReportGHistoryMonthly (std::string &);

View file

@ -742,74 +742,6 @@ int handleReportSummary (std::string &outs)
return rc;
}
////////////////////////////////////////////////////////////////////////////////
// A summary of the most important pending tasks.
//
// For every project, pull important tasks to present as an 'immediate' task
// list. This hides the overwhelming quantity of other tasks.
//
// Present at most three tasks for every project. Select the tasks using
// these criteria:
// - due:< 1wk, pri:*
// - due:*, pri:H
// - pri:H
// - due:*, pri:M
// - pri:M
// - due:*, pri:L
// - pri:L
// - due:*, pri:* <-- everything else
//
// Make the "three" tasks a configurable number
//
int handleReportNext (std::string &outs)
{
// Load report configuration.
std::string columnList = context.config.get ("report.next.columns");
std::string labelList = context.config.get ("report.next.labels");
std::string sortList = context.config.get ("report.next.sort");
std::string filterList = context.config.get ("report.next.filter");
std::vector <std::string> filterArgs;
split (filterArgs, filterList, ' ');
{
Cmd cmd ("next");
Task task;
Sequence sequence;
Subst subst;
Filter filter;
context.parse (filterArgs, cmd, task, sequence, subst, filter);
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);
}
// Get all the tasks.
std::vector <Task> tasks;
context.tdb.lock (context.config.getBoolean ("locking"));
handleRecurrence ();
context.tdb.load (tasks, context.filter);
context.tdb.commit ();
context.tdb.unlock ();
// Restrict to matching subset.
gatherNextTasks (tasks);
return runCustomReport (
"next",
columnList,
labelList,
sortList,
filterList,
tasks,
outs);
}
////////////////////////////////////////////////////////////////////////////////
// Year Month Added Completed Deleted
// 2006 November 87 63 14