Sorting
- Added missing custom sorting for due dates.
This commit is contained in:
27
src/sort.cpp
27
src/sort.cpp
@@ -137,9 +137,32 @@ static bool sort_compare (int left, int right)
|
||||
(left_string == "H" && (right_string == "M" || right_string == "L"));
|
||||
}
|
||||
|
||||
// Due Date.
|
||||
else if (field == "due")
|
||||
{
|
||||
left_string = (*global_data)[left].get (field);
|
||||
right_string = (*global_data)[right].get (field);
|
||||
|
||||
if (left_string != "" && right_string == "")
|
||||
return true;
|
||||
|
||||
if (left_string == "" && right_string != "")
|
||||
return false;
|
||||
|
||||
if (left_string == right_string)
|
||||
continue;
|
||||
|
||||
left_date = atoi (left_string.c_str ());
|
||||
right_date = atoi (right_string.c_str ());
|
||||
|
||||
if (ascending)
|
||||
return left_date < right_date;
|
||||
|
||||
return left_date > right_date;
|
||||
}
|
||||
|
||||
// Date.
|
||||
else if (field == "due" ||
|
||||
field == "end" ||
|
||||
else if (field == "end" ||
|
||||
field == "entry" ||
|
||||
field == "start" ||
|
||||
field == "until" ||
|
||||
|
||||
@@ -42,8 +42,8 @@ if (open my $fh, '>', 'custom.rc')
|
||||
ok (-r 'custom.rc', 'Created custom.rc');
|
||||
}
|
||||
|
||||
# Generate the usage screen, and locate the custom report on it.
|
||||
my $output = qx{../src/task rc:custom.rc usage};
|
||||
# Generate the help screen, and locate the custom report on it.
|
||||
my $output = qx{../src/task rc:custom.rc help};
|
||||
like ($output, qr/task foo \[tags\] \[attrs\] desc\.\.\.\s+DESC\n/m, 'report.foo');
|
||||
|
||||
qx{../src/task rc:custom.rc add project:A one};
|
||||
|
||||
Reference in New Issue
Block a user