mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
Enhancement - calendar report
- Implemented calendar report.
This commit is contained in:
parent
9004b65956
commit
ffd887747f
2 changed files with 13 additions and 19 deletions
|
@ -162,9 +162,7 @@ std::string Context::dispatch ()
|
||||||
int gcMod = 0; // Change occurred by way of gc.
|
int gcMod = 0; // Change occurred by way of gc.
|
||||||
std::string out;
|
std::string out;
|
||||||
|
|
||||||
// TODO Look at this thing. It just cries out for a dispatch table.
|
// TODO Just look at this thing. It just cries out for a dispatch table.
|
||||||
/*
|
|
||||||
*/
|
|
||||||
if (cmd.command == "projects") { out = handleProjects (); }
|
if (cmd.command == "projects") { out = handleProjects (); }
|
||||||
else if (cmd.command == "tags") { out = handleTags (); }
|
else if (cmd.command == "tags") { out = handleTags (); }
|
||||||
else if (cmd.command == "colors") { out = handleColor (); }
|
else if (cmd.command == "colors") { out = handleColor (); }
|
||||||
|
@ -175,9 +173,7 @@ std::string Context::dispatch ()
|
||||||
else if (cmd.command == "history") { out = handleReportHistory (); }
|
else if (cmd.command == "history") { out = handleReportHistory (); }
|
||||||
else if (cmd.command == "ghistory") { out = handleReportGHistory (); }
|
else if (cmd.command == "ghistory") { out = handleReportGHistory (); }
|
||||||
else if (cmd.command == "summary") { out = handleReportSummary (); }
|
else if (cmd.command == "summary") { out = handleReportSummary (); }
|
||||||
/*
|
|
||||||
else if (cmd.command == "calendar") { out = handleReportCalendar (); }
|
else if (cmd.command == "calendar") { out = handleReportCalendar (); }
|
||||||
*/
|
|
||||||
else if (cmd.command == "timesheet") { out = handleReportTimesheet (); }
|
else if (cmd.command == "timesheet") { out = handleReportTimesheet (); }
|
||||||
else if (cmd.command == "add") { out = handleAdd (); }
|
else if (cmd.command == "add") { out = handleAdd (); }
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -1473,9 +1473,6 @@ std::string renderMonths (
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
std::string handleReportCalendar ()
|
std::string handleReportCalendar ()
|
||||||
{
|
{
|
||||||
std::stringstream out;
|
|
||||||
|
|
||||||
/*
|
|
||||||
// Each month requires 28 text columns width. See how many will actually
|
// Each month requires 28 text columns width. See how many will actually
|
||||||
// fit. But if a preference is specified, and it fits, use it.
|
// fit. But if a preference is specified, and it fits, use it.
|
||||||
int width = context.getWidth ();
|
int width = context.getWidth ();
|
||||||
|
@ -1486,21 +1483,21 @@ std::string handleReportCalendar ()
|
||||||
if (preferredMonthsPerLine != 0 && preferredMonthsPerLine < monthsThatFit)
|
if (preferredMonthsPerLine != 0 && preferredMonthsPerLine < monthsThatFit)
|
||||||
monthsPerLine = preferredMonthsPerLine;
|
monthsPerLine = preferredMonthsPerLine;
|
||||||
|
|
||||||
// Load all the pending tasks.
|
// Get all the tasks.
|
||||||
std::vector <T> pending;
|
std::vector <Task> tasks;
|
||||||
tdb.allPendingT (pending);
|
context.tdb.lock (context.config.get ("locking", true));
|
||||||
handleRecurrence (tdb, pending);
|
context.tdb.loadPending (tasks, context.filter);
|
||||||
filter (pending, task);
|
context.tdb.unlock ();
|
||||||
|
// TODO handleRecurrence (tdb, tasks);
|
||||||
|
|
||||||
// Find the oldest pending due date.
|
// Find the oldest pending due date.
|
||||||
Date oldest;
|
Date oldest;
|
||||||
Date newest;
|
Date newest;
|
||||||
std::vector <T>::iterator it;
|
foreach (task, tasks)
|
||||||
for (it = pending.begin (); it != pending.end (); ++it)
|
|
||||||
{
|
{
|
||||||
if (it->has ("due"))
|
if (task->has ("due"))
|
||||||
{
|
{
|
||||||
Date d (::atoi (it->get ("due").c_str ()));
|
Date d (::atoi (task->get ("due").c_str ()));
|
||||||
|
|
||||||
if (d < oldest) oldest = d;
|
if (d < oldest) oldest = d;
|
||||||
if (d > newest) newest = d;
|
if (d > newest) newest = d;
|
||||||
|
@ -1515,6 +1512,7 @@ std::string handleReportCalendar ()
|
||||||
int mTo = newest.month ();
|
int mTo = newest.month ();
|
||||||
int yTo = newest.year ();
|
int yTo = newest.year ();
|
||||||
|
|
||||||
|
std::stringstream out;
|
||||||
out << std::endl;
|
out << std::endl;
|
||||||
std::string output;
|
std::string output;
|
||||||
|
|
||||||
|
@ -1562,7 +1560,7 @@ std::string handleReportCalendar ()
|
||||||
|
|
||||||
out << std::endl
|
out << std::endl
|
||||||
<< optionalBlankLine ()
|
<< optionalBlankLine ()
|
||||||
<< renderMonths (mFrom, yFrom, today, pending, monthsPerLine)
|
<< renderMonths (mFrom, yFrom, today, tasks, monthsPerLine)
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
|
|
||||||
mFrom += monthsPerLine;
|
mFrom += monthsPerLine;
|
||||||
|
@ -1583,7 +1581,7 @@ std::string handleReportCalendar ()
|
||||||
<< "."
|
<< "."
|
||||||
<< optionalBlankLine ()
|
<< optionalBlankLine ()
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
*/
|
|
||||||
return out.str ();
|
return out.str ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue