mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
Sorting
- Added missing custom sorting for due dates.
This commit is contained in:
parent
5fa77a36de
commit
c1b4f34a70
2 changed files with 27 additions and 4 deletions
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};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue