mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
Bug
- Fixed bug that caused dependencies to be sorted by UUID, although they are shown as IDs. - Updated unit test to accomodate new comma-less formatting of dependencies.
This commit is contained in:
parent
4f8c503a04
commit
1d10370341
3 changed files with 31 additions and 3 deletions
|
@ -96,7 +96,6 @@ std::string ViewText::render ()
|
|||
// Determine minimal, ideal column widths.
|
||||
std::vector <int> minimal;
|
||||
std::vector <int> ideal;
|
||||
|
||||
for (int col = 0; col < _columns.size (); ++col)
|
||||
{
|
||||
// Headers factor in to width calculations.
|
||||
|
|
31
src/sort.cpp
31
src/sort.cpp
|
@ -25,6 +25,7 @@
|
|||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <iostream> // TODO Remove
|
||||
#include <algorithm>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
@ -99,9 +100,37 @@ static bool sort_compare (int left, int right)
|
|||
return left_number > right_number;
|
||||
}
|
||||
|
||||
// Depends string.
|
||||
else if (field == "depends")
|
||||
{
|
||||
// Raw data is a comma-separated list of uuids
|
||||
left_string = (*global_data)[left].get (field);
|
||||
right_string = (*global_data)[right].get (field);
|
||||
|
||||
if (left_string == right_string)
|
||||
continue;
|
||||
|
||||
if (left_string == "" && right_string != "")
|
||||
return ascending;
|
||||
|
||||
if (left_string != "" && right_string == "")
|
||||
return !ascending;
|
||||
|
||||
// Sort on the first dependency.
|
||||
left_number = context.tdb.id (left_string.substr (0, 36));
|
||||
right_number = context.tdb.id (right_string.substr (0, 36));
|
||||
|
||||
if (left_number == right_number)
|
||||
continue;
|
||||
|
||||
if (ascending)
|
||||
return left_number < right_number;
|
||||
|
||||
return left_number > right_number;
|
||||
}
|
||||
|
||||
// String.
|
||||
else if (field == "description" ||
|
||||
field == "depends" ||
|
||||
field == "project" ||
|
||||
field == "status" ||
|
||||
field == "tags" ||
|
||||
|
|
|
@ -156,7 +156,7 @@ qx{../src/task rc:dep.rc do 2};
|
|||
|
||||
# [27]
|
||||
$output = qx{../src/task rc:dep.rc depreport};
|
||||
like ($output, qr/\s1\s+2,3\s+One\s+/, 'dependencies - depends report column reflects changed IDs');
|
||||
like ($output, qr/\s1\s+2 3\s+One\s+/, 'dependencies - depends report column reflects changed IDs');
|
||||
|
||||
# [28]
|
||||
qx{../src/task rc:dep.rc do 3};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue