mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
New Report - timesheet
- Added new timesheet report framework - Began adding logic pseudo-code - Added some documentation
This commit is contained in:
parent
f73281ee30
commit
57a11a74e1
6 changed files with 94 additions and 12 deletions
|
@ -219,6 +219,17 @@ Year Month Added Completed Deleted Net
|
||||||
number decreased as more task were completed than added.
|
number decreased as more task were completed than added.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
<strong>% task ghistory</strong>
|
||||||
|
<p>
|
||||||
|
The ghistory report is a "graphical" version of the history
|
||||||
|
report. It shows a colored bar graph and legend.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<strong>% task timesheet</strong>
|
||||||
|
<p>
|
||||||
|
???
|
||||||
|
</p>
|
||||||
|
|
||||||
<strong>% task calendar</strong>
|
<strong>% task calendar</strong>
|
||||||
<p>
|
<p>
|
||||||
This report shows a calendar of the current month, with any task
|
This report shows a calendar of the current month, with any task
|
||||||
|
|
|
@ -186,6 +186,12 @@
|
||||||
only show as many that will fit.
|
only show as many that will fit.
|
||||||
</dd>
|
</dd>
|
||||||
|
|
||||||
|
<dt>weekstart</dt>
|
||||||
|
<dd>
|
||||||
|
The day of the week that represents the first day of the week.
|
||||||
|
Defaults to "Monday".
|
||||||
|
</dd>
|
||||||
|
|
||||||
<dt>defaultwidth</dt>
|
<dt>defaultwidth</dt>
|
||||||
<dd>
|
<dd>
|
||||||
The width of tables used when ncurses support is not available.
|
The width of tables used when ncurses support is not available.
|
||||||
|
|
|
@ -116,6 +116,7 @@ static const char* attributes[] =
|
||||||
"",
|
"",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Alphabetical please.
|
||||||
static const char* commands[] =
|
static const char* commands[] =
|
||||||
{
|
{
|
||||||
"active",
|
"active",
|
||||||
|
@ -141,6 +142,7 @@ static const char* commands[] =
|
||||||
"stop",
|
"stop",
|
||||||
"summary",
|
"summary",
|
||||||
"tags",
|
"tags",
|
||||||
|
"timesheet",
|
||||||
"undelete",
|
"undelete",
|
||||||
"undo",
|
"undo",
|
||||||
"version",
|
"version",
|
||||||
|
|
|
@ -1234,6 +1234,63 @@ std::string handleReportGHistory (TDB& tdb, T& task, Config& conf)
|
||||||
return out.str ();
|
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 (
|
std::string renderMonths (
|
||||||
int firstMonth,
|
int firstMonth,
|
||||||
|
|
29
src/task.cpp
29
src/task.cpp
|
@ -148,6 +148,10 @@ static std::string shortUsage (Config& conf)
|
||||||
table.addCell (row, 1, "task summary");
|
table.addCell (row, 1, "task summary");
|
||||||
table.addCell (row, 2, "Shows a report of task status by project");
|
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 ();
|
row = table.addRow ();
|
||||||
table.addCell (row, 1, "task history");
|
table.addCell (row, 1, "task history");
|
||||||
table.addCell (row, 2, "Shows a report of task history, by month");
|
table.addCell (row, 2, "Shows a report of task history, by month");
|
||||||
|
@ -841,18 +845,19 @@ std::string runTaskCommand (
|
||||||
std::string out;
|
std::string out;
|
||||||
|
|
||||||
// Read-only commands with no side effects.
|
// Read-only commands with no side effects.
|
||||||
if (command == "export") { out = handleExport (tdb, task, conf); }
|
if (command == "export") { out = handleExport (tdb, task, conf); }
|
||||||
else if (command == "projects") { out = handleProjects (tdb, task, conf); }
|
else if (command == "projects") { out = handleProjects (tdb, task, conf); }
|
||||||
else if (command == "tags") { out = handleTags (tdb, task, conf); }
|
else if (command == "tags") { out = handleTags (tdb, task, conf); }
|
||||||
else if (command == "info") { out = handleInfo (tdb, task, conf); }
|
else if (command == "info") { out = handleInfo (tdb, task, conf); }
|
||||||
else if (command == "stats") { out = handleReportStats (tdb, task, conf); }
|
else if (command == "stats") { out = handleReportStats (tdb, task, conf); }
|
||||||
else if (command == "history") { out = handleReportHistory (tdb, task, conf); }
|
else if (command == "history") { out = handleReportHistory (tdb, task, conf); }
|
||||||
else if (command == "ghistory") { out = handleReportGHistory (tdb, task, conf); }
|
else if (command == "ghistory") { out = handleReportGHistory (tdb, task, conf); }
|
||||||
else if (command == "calendar") { out = handleReportCalendar (tdb, task, conf); }
|
else if (command == "calendar") { out = handleReportCalendar (tdb, task, conf); }
|
||||||
else if (command == "summary") { out = handleReportSummary (tdb, task, conf); }
|
else if (command == "summary") { out = handleReportSummary (tdb, task, conf); }
|
||||||
else if (command == "colors") { out = handleColor ( conf); }
|
else if (command == "timesheet") { out = handleReportTimesheet (tdb, task, conf); }
|
||||||
else if (command == "version") { out = handleVersion ( conf); }
|
else if (command == "colors") { out = handleColor ( conf); }
|
||||||
else if (command == "help") { out = longUsage ( conf); }
|
else if (command == "version") { out = handleVersion ( conf); }
|
||||||
|
else if (command == "help") { out = longUsage ( conf); }
|
||||||
|
|
||||||
// Commands that cause updates.
|
// Commands that cause updates.
|
||||||
else if (command == "" && task.getId ()) { cmdMod = true; out = handleModify (tdb, task, conf); }
|
else if (command == "" && task.getId ()) { cmdMod = true; out = handleModify (tdb, task, conf); }
|
||||||
|
|
|
@ -103,6 +103,7 @@ std::string handleReportCalendar (TDB&, T&, Config&);
|
||||||
std::string handleReportActive (TDB&, T&, Config&);
|
std::string handleReportActive (TDB&, T&, Config&);
|
||||||
std::string handleReportOverdue (TDB&, T&, Config&);
|
std::string handleReportOverdue (TDB&, T&, Config&);
|
||||||
std::string handleReportStats (TDB&, T&, Config&);
|
std::string handleReportStats (TDB&, T&, Config&);
|
||||||
|
std::string handleReportTimesheet (TDB&, T&, Config&);
|
||||||
|
|
||||||
std::string handleCustomReport (TDB&, T&, Config&, const std::string&);
|
std::string handleCustomReport (TDB&, T&, Config&, const std::string&);
|
||||||
void validReportColumns (const std::vector <std::string>&);
|
void validReportColumns (const std::vector <std::string>&);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue