mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
Merge branch 'timesheet' into 1.7.0
This commit is contained in:
commit
f9c3103264
6 changed files with 94 additions and 12 deletions
|
@ -116,6 +116,7 @@ static const char* attributes[] =
|
|||
"",
|
||||
};
|
||||
|
||||
// Alphabetical please.
|
||||
static const char* commands[] =
|
||||
{
|
||||
"active",
|
||||
|
@ -142,6 +143,7 @@ static const char* commands[] =
|
|||
"stop",
|
||||
"summary",
|
||||
"tags",
|
||||
"timesheet",
|
||||
"undelete",
|
||||
"undo",
|
||||
"version",
|
||||
|
|
|
@ -1299,6 +1299,63 @@ std::string handleReportGHistory (TDB& tdb, T& task, Config& conf)
|
|||
return out.str ();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
std::string handleReportTimesheet (TDB& tdb, T& task, Config& conf)
|
||||
{
|
||||
std::stringstream out;
|
||||
|
||||
// Determine window size, and set table accordingly.
|
||||
int width = conf.get ("defaultwidth", (int) 80);
|
||||
#ifdef HAVE_LIBNCURSES
|
||||
if (conf.get ("curses", true))
|
||||
{
|
||||
WINDOW* w = initscr ();
|
||||
width = w->_maxx + 1;
|
||||
endwin ();
|
||||
}
|
||||
#endif
|
||||
|
||||
// Get all the tasks.
|
||||
std::vector <T> tasks;
|
||||
tdb.allT (tasks);
|
||||
filter (tasks, task);
|
||||
|
||||
// TODO Was a duration argument specified?
|
||||
// by default, duration = 1week
|
||||
// TODO Determine start date
|
||||
// by default, start = prior Monday
|
||||
// otherwise, start = prior Monday - ((duration - 1) * 7 * 86,400)
|
||||
// TODO end date = next Sunday
|
||||
|
||||
Table table;
|
||||
|
||||
// TODO Render report
|
||||
/*
|
||||
% task timesheet [filter] 2w
|
||||
|
||||
4/19/2009 - 4/26/2009
|
||||
...
|
||||
|
||||
4/27/2009 - 5/3/2009
|
||||
Tasks Completed (5)
|
||||
<project> <description> <annotations>
|
||||
...
|
||||
|
||||
Tasks Started (2)
|
||||
<project> <description> <annotations>
|
||||
...
|
||||
*/
|
||||
|
||||
if (table.rowCount ())
|
||||
out << optionalBlankLine (conf)
|
||||
<< table.render ()
|
||||
<< std::endl;
|
||||
else
|
||||
out << "No tasks." << std::endl;
|
||||
|
||||
return out.str ();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
std::string renderMonths (
|
||||
int firstMonth,
|
||||
|
|
29
src/task.cpp
29
src/task.cpp
|
@ -152,6 +152,10 @@ static std::string shortUsage (Config& conf)
|
|||
table.addCell (row, 1, "task summary");
|
||||
table.addCell (row, 2, "Shows a report of task status by project");
|
||||
|
||||
row = table.addRow ();
|
||||
table.addCell (row, 1, "task timesheet [duration]");
|
||||
table.addCell (row, 2, "Shows a weekly report of tasks completed and started");
|
||||
|
||||
row = table.addRow ();
|
||||
table.addCell (row, 1, "task history");
|
||||
table.addCell (row, 2, "Shows a report of task history, by month");
|
||||
|
@ -861,18 +865,19 @@ std::string runTaskCommand (
|
|||
std::string out;
|
||||
|
||||
// Read-only commands with no side effects.
|
||||
if (command == "export") { out = handleExport (tdb, task, conf); }
|
||||
else if (command == "projects") { out = handleProjects (tdb, task, conf); }
|
||||
else if (command == "tags") { out = handleTags (tdb, task, conf); }
|
||||
else if (command == "info") { out = handleInfo (tdb, task, conf); }
|
||||
else if (command == "stats") { out = handleReportStats (tdb, task, conf); }
|
||||
else if (command == "history") { out = handleReportHistory (tdb, task, conf); }
|
||||
else if (command == "ghistory") { out = handleReportGHistory (tdb, task, conf); }
|
||||
else if (command == "calendar") { out = handleReportCalendar (tdb, task, conf); }
|
||||
else if (command == "summary") { out = handleReportSummary (tdb, task, conf); }
|
||||
else if (command == "colors") { out = handleColor ( conf); }
|
||||
else if (command == "version") { out = handleVersion ( conf); }
|
||||
else if (command == "help") { out = longUsage ( conf); }
|
||||
if (command == "export") { out = handleExport (tdb, task, conf); }
|
||||
else if (command == "projects") { out = handleProjects (tdb, task, conf); }
|
||||
else if (command == "tags") { out = handleTags (tdb, task, conf); }
|
||||
else if (command == "info") { out = handleInfo (tdb, task, conf); }
|
||||
else if (command == "stats") { out = handleReportStats (tdb, task, conf); }
|
||||
else if (command == "history") { out = handleReportHistory (tdb, task, conf); }
|
||||
else if (command == "ghistory") { out = handleReportGHistory (tdb, task, conf); }
|
||||
else if (command == "calendar") { out = handleReportCalendar (tdb, task, conf); }
|
||||
else if (command == "summary") { out = handleReportSummary (tdb, task, conf); }
|
||||
else if (command == "timesheet") { out = handleReportTimesheet (tdb, task, conf); }
|
||||
else if (command == "colors") { out = handleColor ( conf); }
|
||||
else if (command == "version") { out = handleVersion ( conf); }
|
||||
else if (command == "help") { out = longUsage ( conf); }
|
||||
|
||||
// Commands that cause updates.
|
||||
else if (command == "" && task.getId ()) { cmdMod = true; out = handleModify (tdb, task, conf); }
|
||||
|
|
|
@ -110,6 +110,7 @@ std::string handleReportCalendar (TDB&, T&, Config&);
|
|||
std::string handleReportActive (TDB&, T&, Config&);
|
||||
std::string handleReportOverdue (TDB&, T&, Config&);
|
||||
std::string handleReportStats (TDB&, T&, Config&);
|
||||
std::string handleReportTimesheet (TDB&, T&, Config&);
|
||||
|
||||
std::string handleCustomReport (TDB&, T&, Config&, const std::string&);
|
||||
void validReportColumns (const std::vector <std::string>&);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue