mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
Bug #438 - Reports sorting by end_time, start_time, and entry_time are ordered incorrectly
- Fixed bug #438, correcting the sorting of the entry_time, start_time and end_time columns (thanks to Michelle Crane). - Reordered ChangeLog so that bugs, features are in sequence. Don't know why I did this. Some inner compulsion. - Deprecated silly start_time, end_time and entry_time columns, which are now (and were) superseded by start, end and entry columns with time formats. - Config.cpp now detects use of these deprecated fields and complains to the show command. - Date.cpp now uses the variable 'input' instead of 'mdy', which was confusing and implied that it contained a date without a time. - Obsoleted and removed Date::toStringWithTime, which ignored requested formats. - When checking for an epoch, Date::isEpoch just looked for strings of more than 8 digits. The additional restriction of less than or equal to 10 digits was added. This was breaking unit tests using the dateformat YMDHNS, which is reasonable. - Removed the obsolete field format hooks format-entry_time, format-start_time and format-end_time - Removed the obsolete field format hook unit tests hook.format-entry_time.t, hook.format-start_time.t and hook.format-end_time.t. - Removed use of deprecated field in hook.format-countdown_compact.t. - Added missing shortcut comparisons in Table::sort that was causing an unnecessary full parse of dates even if they were identical as strings. - Coded entry_time as a synonym for entry. Ditto for start_time and end_time. - Marked the new synonyms as deprecated. - Added bug.438.t unit test. - Added deprecated fields to the NEWS file.
This commit is contained in:
parent
a57326a026
commit
1a34a29b7a
16 changed files with 232 additions and 444 deletions
|
@ -235,7 +235,7 @@ int handleCustomReport (const std::string& report, std::string &outs)
|
|||
}
|
||||
}
|
||||
|
||||
else if (*col == "entry")
|
||||
else if (*col == "entry" || *col == "entry_time")
|
||||
{
|
||||
table.addColumn (columnLabels[*col] != "" ? columnLabels[*col] : "Added");
|
||||
table.setColumnWidth (columnCount, Table::minimum);
|
||||
|
@ -255,27 +255,7 @@ int handleCustomReport (const std::string& report, std::string &outs)
|
|||
}
|
||||
}
|
||||
|
||||
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"));
|
||||
context.hooks.trigger ("format-entry_time", "entry_time", entered);
|
||||
table.addCell (row, columnCount, entered);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else if (*col == "start")
|
||||
else if (*col == "start" || *col == "start_time")
|
||||
{
|
||||
table.addColumn (columnLabels[*col] != "" ? columnLabels[*col] : "Started");
|
||||
table.setColumnWidth (columnCount, Table::minimum);
|
||||
|
@ -295,27 +275,7 @@ int handleCustomReport (const std::string& report, std::string &outs)
|
|||
}
|
||||
}
|
||||
|
||||
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"));
|
||||
context.hooks.trigger ("format-start_time", "start_time", started);
|
||||
table.addCell (row, columnCount, started);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else if (*col == "end")
|
||||
else if (*col == "end" || *col == "end_time")
|
||||
{
|
||||
table.addColumn (columnLabels[*col] != "" ? columnLabels[*col] : "Completed");
|
||||
table.setColumnWidth (columnCount, Table::minimum);
|
||||
|
@ -335,28 +295,6 @@ int handleCustomReport (const std::string& report, std::string &outs)
|
|||
}
|
||||
}
|
||||
|
||||
else if (*col == "end_time")
|
||||
{
|
||||
table.addColumn (columnLabels[*col] != "" ? columnLabels[*col] : "Completed");
|
||||
table.setColumnWidth (columnCount, Table::minimum);
|
||||
table.setColumnJustification (columnCount, Table::right);
|
||||
|
||||
std::string format = context.config.get ("dateformat");
|
||||
|
||||
std::string ended;
|
||||
for (unsigned int row = 0; row < tasks.size(); ++row)
|
||||
{
|
||||
ended = tasks[row].get ("end");
|
||||
if (ended.length ())
|
||||
{
|
||||
Date dt (::atoi (ended.c_str ()));
|
||||
ended = dt.toStringWithTime (format);
|
||||
context.hooks.trigger ("format-end_time", "end_time", ended);
|
||||
table.addCell (row, columnCount, ended);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else if (*col == "due")
|
||||
{
|
||||
table.addColumn (columnLabels[*col] != "" ? columnLabels[*col] : "Due");
|
||||
|
@ -645,8 +583,9 @@ int handleCustomReport (const std::string& report, std::string &outs)
|
|||
Table::ascendingPriority :
|
||||
Table::descendingPriority));
|
||||
|
||||
else if (column == "entry" || column == "start" || column == "wait" ||
|
||||
column == "until" || column == "end")
|
||||
else if (column == "entry" || column == "start" || column == "wait" ||
|
||||
column == "until" || column == "end" || column == "entry_time" ||
|
||||
column == "start_time" || column == "end_time")
|
||||
table.sortOn (columnIndex[column],
|
||||
(direction == '+' ?
|
||||
Table::ascendingDate :
|
||||
|
@ -753,11 +692,11 @@ void validReportColumns (const std::vector <std::string>& columns)
|
|||
*it != "priority" &&
|
||||
*it != "priority_long" &&
|
||||
*it != "entry" &&
|
||||
*it != "entry_time" &&
|
||||
*it != "entry_time" && // TODO Deprecated
|
||||
*it != "start" &&
|
||||
*it != "start_time" &&
|
||||
*it != "start_time" && // TODO Deprecated
|
||||
*it != "end" &&
|
||||
*it != "end_time" &&
|
||||
*it != "end_time" && // TODO Deprecated
|
||||
*it != "due" &&
|
||||
*it != "countdown" &&
|
||||
*it != "countdown_compact" &&
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue