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:
@@ -96,7 +96,6 @@ std::string ViewText::render ()
|
|||||||
// Determine minimal, ideal column widths.
|
// Determine minimal, ideal column widths.
|
||||||
std::vector <int> minimal;
|
std::vector <int> minimal;
|
||||||
std::vector <int> ideal;
|
std::vector <int> ideal;
|
||||||
|
|
||||||
for (int col = 0; col < _columns.size (); ++col)
|
for (int col = 0; col < _columns.size (); ++col)
|
||||||
{
|
{
|
||||||
// Headers factor in to width calculations.
|
// 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 <algorithm>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <string>
|
#include <string>
|
||||||
@@ -99,9 +100,37 @@ static bool sort_compare (int left, int right)
|
|||||||
return left_number > right_number;
|
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.
|
// String.
|
||||||
else if (field == "description" ||
|
else if (field == "description" ||
|
||||||
field == "depends" ||
|
|
||||||
field == "project" ||
|
field == "project" ||
|
||||||
field == "status" ||
|
field == "status" ||
|
||||||
field == "tags" ||
|
field == "tags" ||
|
||||||
|
|||||||
@@ -156,7 +156,7 @@ qx{../src/task rc:dep.rc do 2};
|
|||||||
|
|
||||||
# [27]
|
# [27]
|
||||||
$output = qx{../src/task rc:dep.rc depreport};
|
$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]
|
# [28]
|
||||||
qx{../src/task rc:dep.rc do 3};
|
qx{../src/task rc:dep.rc do 3};
|
||||||
|
|||||||
Reference in New Issue
Block a user