Bug #312 - Task sorting

- Fixed bug #132, which failed to set a sort order so that active tasks sort
  higher than inactive tasks, all things being equal.
- All reports that include the 'active' column now sort on that column.
This commit is contained in:
Paul Beckingham 2010-06-27 15:00:48 -04:00
parent 0f7cf1cd52
commit 66fcdfe01f
3 changed files with 76 additions and 5 deletions

View file

@ -43,6 +43,8 @@
(thanks to Michell Crane).
+ Fixed bug #418, which caused the attribute modifier 'due.before' to fail
if the year was not included in the dateformat (thanks to Michelle Crane).
+ Fixed bug #132, which failed to set a sort order so that active tasks sort
higher than inactive tasks, all things being equal.
------ old releases ------------------------------

View file

@ -195,7 +195,7 @@ std::string Config::defaults =
"report.list.description=Lists all tasks matching the specified criteria\n"
"report.list.columns=id,project,priority,due,active,age,description\n"
"report.list.labels=ID,Project,Pri,Due,Active,Age,Description\n"
"report.list.sort=due+,priority-,project+\n"
"report.list.sort=due+,priority-,active-,project+\n"
"report.list.filter=status:pending\n"
"#report.list.dateformat=m/d/Y\n"
"#report.list.annotations=full\n"
@ -240,7 +240,7 @@ std::string Config::defaults =
"report.overdue.description=Lists overdue tasks matching the specified criteria\n"
"report.overdue.columns=id,project,priority,due,active,age,description\n"
"report.overdue.labels=ID,Project,Pri,Due,Active,Age,Description\n"
"report.overdue.sort=due+,priority-,project+\n"
"report.overdue.sort=due+,priority-,active-,project+\n"
"report.overdue.filter=status:pending due.before:today\n"
"#report.overdue.dateformat=m/d/Y\n"
"#report.overdue.annotations=full\n"
@ -267,7 +267,7 @@ std::string Config::defaults =
"report.recurring.description=Lists recurring tasks matching the specified criteria\n"
"report.recurring.columns=id,project,priority,due,recur,active,age,description\n"
"report.recurring.labels=ID,Project,Pri,Due,Recur,Active,Age,Description\n"
"report.recurring.sort=due+,priority-,project+\n"
"report.recurring.sort=due+,priority-,active-,project+\n"
"report.recurring.filter=status:pending parent.any:\n"
"#report.recurring.dateformat=m/d/Y\n"
"#report.recurring.annotations=full\n"
@ -285,7 +285,7 @@ std::string Config::defaults =
"report.all.description=Lists all tasks matching the specified criteria\n"
"report.all.columns=id,project,priority,due,active,age,description\n"
"report.all.labels=ID,Project,Pri,Due,Active,Age,Description\n"
"report.all.sort=due+,priority-,project+\n"
"report.all.sort=due+,priority-,active-,project+\n"
"#report.all.dateformat=m/d/Y\n"
"#report.all.annotations=full\n"
"\n"
@ -293,7 +293,7 @@ std::string Config::defaults =
"report.next.description=Lists the most urgent tasks\n"
"report.next.columns=id,project,priority,due,active,age,description\n"
"report.next.labels=ID,Project,Pri,Due,Active,Age,Description\n"
"report.next.sort=due+,priority-,project+\n"
"report.next.sort=due+,priority-,active-,project+\n"
"report.next.filter=status:pending limit:page\n"
"#report.next.dateformat=m/d/Y\n"
"#report.next.annotations=full\n"

69
src/tests/sorting.t Executable file
View file

@ -0,0 +1,69 @@
#! /usr/bin/perl
################################################################################
## task - a command line task list manager.
##
## Copyright 2006 - 2010, Paul Beckingham.
## All rights reserved.
##
## This program is free software; you can redistribute it and/or modify it under
## the terms of the GNU General Public License as published by the Free Software
## Foundation; either version 2 of the License, or (at your option) any later
## version.
##
## This program is distributed in the hope that it will be useful, but WITHOUT
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
## FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
## details.
##
## You should have received a copy of the GNU General Public License along with
## this program; if not, write to the
##
## Free Software Foundation, Inc.,
## 51 Franklin Street, Fifth Floor,
## Boston, MA
## 02110-1301
## USA
##
################################################################################
use strict;
use warnings;
use Test::More tests => 7;
# Create the rc file.
if (open my $fh, '>', 'sorting.rc')
{
print $fh "data.location=.\n";
close $fh;
ok (-r 'sorting.rc', 'Created sorting.rc');
}
# Test sort order for most reports (including list) of:
# due+,priority-,active+,project+
qx{../task rc:sorting.rc add due:eow priority:H project:A due:tomorrow one};
qx{../task rc:sorting.rc add due:eow priority:H project:B due:tomorrow two};
qx{../task rc:sorting.rc add due:eow priority:H project:C due:tomorrow three};
qx{../task rc:sorting.rc add due:eow priority:H project:D due:tomorrow four};
my $output = qx{../task rc:sorting.rc list};
like ($output, qr/one.+two.+three.+four/ms, 'no active task sorting');
qx{../task rc:sorting.rc start 1};
qx{../task rc:sorting.rc start 3};
$output = qx{../task rc:sorting.rc list};
like ($output, qr/one.+three.+two.+four/ms, 'active task sorting');
# Cleanup.
unlink 'pending.data';
ok (!-r 'pending.data', 'Removed pending.data');
unlink 'completed.data';
ok (!-r 'completed.data', 'Removed completed.data');
unlink 'undo.data';
ok (!-r 'undo.data', 'Removed undo.data');
unlink 'sorting.rc';
ok (!-r 'sorting.rc', 'Removed sorting.rc');
exit 0;