From b553954d378a47e6efd574f0201de0865958272a Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Mon, 3 Jan 2011 22:21:51 -0500 Subject: [PATCH] Bug #597 - Fixed bug #597, which caused a missing project to be counted as a project in the projects command (thanks to Steve Rader). --- ChangeLog | 2 ++ src/command.cpp | 11 +++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index c6c07634c..bfe45a440 100644 --- a/ChangeLog +++ b/ChangeLog @@ -62,6 +62,8 @@ + Fixed bug #595, where taskwarrior ignored changes to the wait date during the edit command, consequently not changing task status (thanks to Eric Fluger). + + Fixed bug #597, which caused a missing project to be counted as a project + in the projects command (thanks to Steve Rader). + Applied patch to fix bug #613, so that the summary report and the projects command now consistently show a missing project as "(none)" (thanks to Steve Rader). diff --git a/src/command.cpp b/src/command.cpp index 52a16659a..160e6face 100644 --- a/src/command.cpp +++ b/src/command.cpp @@ -250,6 +250,7 @@ int handleProjects (std::string& outs) std::map medium; std::map low; std::map none; + bool no_project = false; std::string project; std::string priority; foreach (t, tasks) @@ -258,6 +259,8 @@ int handleProjects (std::string& outs) priority = t->get ("priority"); unique[project] += 1; + if (project == "") + no_project = true; if (priority == "H") high[project] += 1; else if (priority == "M") medium[project] += 1; @@ -306,11 +309,15 @@ int handleProjects (std::string& outs) table.addCell (row, 5, high[i->first]); } + int number_projects = unique.size (); + if (no_project) + --number_projects; + out << optionalBlankLine () << table.render () << optionalBlankLine () - << unique.size () - << (unique.size () == 1 ? " project" : " projects") + << number_projects + << (number_projects == 1 ? " project" : " projects") << " (" << quantity << (quantity == 1 ? " task" : " tasks") << ")\n"; } else