From 8d784da0aed461a3f69b2a211d26bb10a00a184d Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Sun, 29 Nov 2009 08:21:33 -0500 Subject: [PATCH] Bug Fix = #317, sorting - Fixed bug #317 which colored tasks in the 'completed' report according to due dates, which are no longer relevant to a completed task (thanks to Cory Donnelly). - Fixed bug that was causing the 'completed' report to sort incorrectly. --- ChangeLog | 4 ++++ src/custom.cpp | 1 + src/rules.cpp | 14 ++++++++++---- src/tests/bug.bulk.t | 10 +++++----- 4 files changed, 20 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index a0fec7283..063f7877c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -9,6 +9,10 @@ to Juergen Daubert). + Fixed bug #327 that allowed the removal of a due date from a recurring task. + + Fixed bug #317 which colored tasks in the 'completed' report according to + due dates, which are no longer relevant to a completed task (thanks to + Cory Donnelly). + + Fixed bug that was causing the 'completed' report to sort incorrectly. ------ old releases ------------------------------ diff --git a/src/custom.cpp b/src/custom.cpp index 7c9e73d61..4d15779eb 100644 --- a/src/custom.cpp +++ b/src/custom.cpp @@ -461,6 +461,7 @@ int runCustomReport ( std::string column = sortColumn->substr (0, sortColumn->length () - 1); char direction = (*sortColumn)[sortColumn->length () - 1]; + // TODO This code should really be using Att::type. if (column == "id") table.sortOn (columnIndex[column], (direction == '+' ? diff --git a/src/rules.cpp b/src/rules.cpp index 604c5eb3c..484f868a8 100644 --- a/src/rules.cpp +++ b/src/rules.cpp @@ -91,6 +91,8 @@ void autoColorize ( // Note: fg, bg already contain colors specifically assigned via command. // Note: These rules form a hierarchy - the last rule is King. + Task::status status = task.getStatus (); + // Colorization of the tagged. if (gsFg["color.tagged"] != Text::nocolor || gsBg["color.tagged"] != Text::nocolor) @@ -146,9 +148,11 @@ void autoColorize ( } } - // Colorization of the active. - if (gsFg["color.active"] != Text::nocolor || - gsBg["color.active"] != Text::nocolor) + // Colorization of the active, if not completed/deleted. + if ((gsFg["color.active"] != Text::nocolor || + gsBg["color.active"] != Text::nocolor) && + status != Task::completed && + status != Task::deleted) { if (task.has ("start")) { @@ -202,7 +206,9 @@ void autoColorize ( } // Colorization of the due and overdue. - if (task.has ("due")) + if (task.has ("due") && + status != Task::completed && + status != Task::deleted) { std::string due = task.get ("due"); switch (getDueState (due)) diff --git a/src/tests/bug.bulk.t b/src/tests/bug.bulk.t index 2016abc13..5c8d9602c 100755 --- a/src/tests/bug.bulk.t +++ b/src/tests/bug.bulk.t @@ -28,7 +28,7 @@ use strict; use warnings; -use Test::More tests => 14; +use Test::More tests => 15; # Create the rc file. if (open my $fh, '>', 'bulk.rc') @@ -49,13 +49,13 @@ qx{../task rc:bulk.rc add t4 due:thursday}; qx{../task rc:bulk.rc add t5 due:friday}; qx{../task rc:bulk.rc add t6 due:saturday}; -my $output = qx{yes|../task rc:bulk.rc pro:p1 pri:M 4 5 6}; +my $output = qx{echo "quit"|../task rc:bulk.rc pro:p1 pri:M 4 5 6}; +like ($output, qr/Modified 0 tasks/, '"quit" prevents any further modifications'); + +my $output = qx{echo "all"|../task rc:bulk.rc pro:p1 pri:M 4 5 6}; unlike ($output, qr/Task 4 "t4"\n - No changes were made/, 'Task 4 modified'); unlike ($output, qr/Task 5 "t5"\n - No changes were made/, 'Task 5 modified'); unlike ($output, qr/Task 6 "t6"\n - No changes were made/, 'Task 6 modified'); -#diag ("---"); -#diag ($output); -#diag ("---"); $output = qx{../task rc:bulk.rc info 4}; like ($output, qr/Project\s+p1/, 'project applied to 4');