- Added missing custom sorting for due dates.
This commit is contained in:
Paul Beckingham 2011-05-11 22:21:43 -04:00
parent 5fa77a36de
commit c1b4f34a70
2 changed files with 27 additions and 4 deletions

View file

@ -137,9 +137,32 @@ static bool sort_compare (int left, int right)
(left_string == "H" && (right_string == "M" || right_string == "L")); (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. // Date.
else if (field == "due" || else if (field == "end" ||
field == "end" ||
field == "entry" || field == "entry" ||
field == "start" || field == "start" ||
field == "until" || field == "until" ||

View file

@ -42,8 +42,8 @@ if (open my $fh, '>', 'custom.rc')
ok (-r 'custom.rc', 'Created custom.rc'); ok (-r 'custom.rc', 'Created custom.rc');
} }
# Generate the usage screen, and locate the custom report on it. # Generate the help screen, and locate the custom report on it.
my $output = qx{../src/task rc:custom.rc usage}; my $output = qx{../src/task rc:custom.rc help};
like ($output, qr/task foo \[tags\] \[attrs\] desc\.\.\.\s+DESC\n/m, 'report.foo'); like ($output, qr/task foo \[tags\] \[attrs\] desc\.\.\.\s+DESC\n/m, 'report.foo');
qx{../src/task rc:custom.rc add project:A one}; qx{../src/task rc:custom.rc add project:A one};