mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
Enhancement - timesheet report
- First pass at a timesheet report. Needs details and formatting improvements.
This commit is contained in:
parent
de4194479a
commit
4ab665b876
1 changed files with 59 additions and 27 deletions
|
@ -1323,38 +1323,70 @@ std::string handleReportTimesheet (TDB& tdb, T& task, Config& conf)
|
||||||
tdb.allT (tasks);
|
tdb.allT (tasks);
|
||||||
filter (tasks, task);
|
filter (tasks, task);
|
||||||
|
|
||||||
// TODO Was a duration argument specified?
|
// What day of the week does the user consider the first?
|
||||||
// by default, duration = 1week
|
int weekStart = Date::dayOfWeek (conf.get ("weekstart", "Monday"));
|
||||||
// TODO Determine start date
|
if (weekStart == -1)
|
||||||
// by default, start = prior Monday
|
throw std::string ("The 'weekstart' configuration variable does "
|
||||||
// otherwise, start = prior Monday - ((duration - 1) * 7 * 86,400)
|
"not contain a day name, such as 'Monday'.");
|
||||||
// TODO end date = next Sunday
|
|
||||||
|
|
||||||
Table table;
|
// Determine the date of the first day of the most recent report.
|
||||||
|
Date today;
|
||||||
|
Date start;
|
||||||
|
start -= (((today.dayOfWeek () - weekStart) + 7) % 7) * 86400;
|
||||||
|
|
||||||
// TODO Render report
|
// Roll back to midnight.
|
||||||
/*
|
start = Date (start.month (), start.day (), start.year ());
|
||||||
% task timesheet [filter] 2w
|
Date end = start + (7 * 86400) - 1;
|
||||||
|
|
||||||
4/19/2009 - 4/26/2009
|
// Determine how many reports to run.
|
||||||
...
|
int quantity = 1;
|
||||||
|
std::vector <int> sequence = task.getAllIds ();
|
||||||
|
if (sequence.size () == 1)
|
||||||
|
quantity = sequence[0];
|
||||||
|
|
||||||
4/27/2009 - 5/3/2009
|
for (int week = 0; week < quantity; ++week)
|
||||||
Tasks Completed (5)
|
{
|
||||||
<project> <description> <annotations>
|
out << start.toString (conf.get ("dateformat", "m/d/Y"))
|
||||||
...
|
<< " - "
|
||||||
|
<< end.toString (conf.get ("dateformat", "m/d/Y"))
|
||||||
Tasks Started (2)
|
|
||||||
<project> <description> <annotations>
|
|
||||||
...
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (table.rowCount ())
|
|
||||||
out << optionalBlankLine (conf)
|
|
||||||
<< table.render ()
|
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
else
|
|
||||||
out << "No tasks." << std::endl;
|
// Render the completed table.
|
||||||
|
Table completed;
|
||||||
|
foreach (t, tasks)
|
||||||
|
{
|
||||||
|
// TODO If task completed within range.
|
||||||
|
}
|
||||||
|
|
||||||
|
out << " Completed (" << completed.rowCount () << ")" << std::endl;
|
||||||
|
|
||||||
|
if (completed.rowCount ())
|
||||||
|
out << optionalBlankLine (conf)
|
||||||
|
<< completed.render ()
|
||||||
|
<< std::endl;
|
||||||
|
else
|
||||||
|
out << " None" << std::endl;
|
||||||
|
|
||||||
|
// Now render the started table.
|
||||||
|
Table started;
|
||||||
|
foreach (t, tasks)
|
||||||
|
{
|
||||||
|
// TODO If task started withing range, but not completed withing range.
|
||||||
|
}
|
||||||
|
|
||||||
|
out << " Started (" << started.rowCount () << ")" << std::endl;
|
||||||
|
|
||||||
|
if (started.rowCount ())
|
||||||
|
out << optionalBlankLine (conf)
|
||||||
|
<< started.render ()
|
||||||
|
<< std::endl;
|
||||||
|
else
|
||||||
|
out << " None" << std::endl;
|
||||||
|
|
||||||
|
// Prior week.
|
||||||
|
start -= 7 * 86400;
|
||||||
|
end -= 7 * 86400;
|
||||||
|
}
|
||||||
|
|
||||||
return out.str ();
|
return out.str ();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue