mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
Enhancement - New columns for custom reports
- Added 'entry_time', 'start_time' and 'end_time' columns that include the time as well as the date.
This commit is contained in:
parent
81ce844d79
commit
4ea71c939a
5 changed files with 105 additions and 0 deletions
|
@ -237,6 +237,25 @@ int runCustomReport (
|
|||
}
|
||||
}
|
||||
|
||||
else if (*col == "entry_time")
|
||||
{
|
||||
table.addColumn (columnLabels[*col] != "" ? columnLabels[*col] : "Added");
|
||||
table.setColumnWidth (columnCount, Table::minimum);
|
||||
table.setColumnJustification (columnCount, Table::right);
|
||||
|
||||
std::string entered;
|
||||
for (unsigned int row = 0; row < tasks.size(); ++row)
|
||||
{
|
||||
entered = tasks[row].get ("entry");
|
||||
if (entered.length ())
|
||||
{
|
||||
Date dt (::atoi (entered.c_str ()));
|
||||
entered = dt.toStringWithTime (context.config.get ("dateformat", "m/d/Y"));
|
||||
table.addCell (row, columnCount, entered);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else if (*col == "start")
|
||||
{
|
||||
table.addColumn (columnLabels[*col] != "" ? columnLabels[*col] : "Started");
|
||||
|
@ -256,6 +275,25 @@ int runCustomReport (
|
|||
}
|
||||
}
|
||||
|
||||
else if (*col == "start_time")
|
||||
{
|
||||
table.addColumn (columnLabels[*col] != "" ? columnLabels[*col] : "Started");
|
||||
table.setColumnWidth (columnCount, Table::minimum);
|
||||
table.setColumnJustification (columnCount, Table::right);
|
||||
|
||||
std::string started;
|
||||
for (unsigned int row = 0; row < tasks.size(); ++row)
|
||||
{
|
||||
started = tasks[row].get ("start");
|
||||
if (started.length ())
|
||||
{
|
||||
Date dt (::atoi (started.c_str ()));
|
||||
started = dt.toStringWithTime (context.config.get ("dateformat", "m/d/Y"));
|
||||
table.addCell (row, columnCount, started);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else if (*col == "end")
|
||||
{
|
||||
table.addColumn (columnLabels[*col] != "" ? columnLabels[*col] : "Completed");
|
||||
|
@ -275,6 +313,25 @@ int runCustomReport (
|
|||
}
|
||||
}
|
||||
|
||||
else if (*col == "end_time")
|
||||
{
|
||||
table.addColumn (columnLabels[*col] != "" ? columnLabels[*col] : "Completed");
|
||||
table.setColumnWidth (columnCount, Table::minimum);
|
||||
table.setColumnJustification (columnCount, Table::right);
|
||||
|
||||
std::string started;
|
||||
for (unsigned int row = 0; row < tasks.size(); ++row)
|
||||
{
|
||||
started = tasks[row].get ("end");
|
||||
if (started.length ())
|
||||
{
|
||||
Date dt (::atoi (started.c_str ()));
|
||||
started = dt.toStringWithTime (context.config.get ("dateformat", "m/d/Y"));
|
||||
table.addCell (row, columnCount, started);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else if (*col == "due")
|
||||
{
|
||||
table.addColumn (columnLabels[*col] != "" ? columnLabels[*col] : "Due");
|
||||
|
@ -576,8 +633,11 @@ void validReportColumns (const std::vector <std::string>& columns)
|
|||
*it != "project" &&
|
||||
*it != "priority" &&
|
||||
*it != "entry" &&
|
||||
*it != "entry_time" &&
|
||||
*it != "start" &&
|
||||
*it != "start_time" &&
|
||||
*it != "end" &&
|
||||
*it != "end_time" &&
|
||||
*it != "due" &&
|
||||
*it != "age" &&
|
||||
*it != "age_compact" &&
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue