mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
Bug 899
- Fixed bug #899, which displayed incorrect project completion numbers (thanks to Paul-Gheorghe Barbu). - Added unit tests.
This commit is contained in:
parent
c092b027a6
commit
bf9e14f581
5 changed files with 68 additions and 15 deletions
1
AUTHORS
1
AUTHORS
|
@ -118,4 +118,5 @@ suggestions:
|
|||
Aaron Jackson
|
||||
Dmitriy Samborskiy
|
||||
Eli Lev
|
||||
Paul-Gheorghe Barbu
|
||||
|
||||
|
|
|
@ -234,6 +234,8 @@
|
|||
std::map::operator[] (thanks to Dmitriy Samborskiy).
|
||||
+ Fixed bug #897, which adds the UUID field to the 'completed' report
|
||||
(thanks to Eli Lev).
|
||||
+ Fixed bug #899, which displayed incorrect project completion numbers (thanks
|
||||
to Paul-Gheorghe Barbu).
|
||||
|
||||
# Untracked Bugs, biggest first.
|
||||
+ Fixed bug that required the '%YAML' prologue in a YAML import.
|
||||
|
|
14
src/TDB2.cpp
14
src/TDB2.cpp
|
@ -92,15 +92,8 @@ void TF2::target (const std::string& f)
|
|||
const std::vector <Task>& TF2::get_tasks ()
|
||||
{
|
||||
if (! _loaded_tasks)
|
||||
{
|
||||
load_tasks ();
|
||||
|
||||
// Apply previously added tasks.
|
||||
std::vector <Task>::iterator i;
|
||||
for (i = _added_tasks.begin (); i != _added_tasks.end (); ++i)
|
||||
_tasks.push_back (*i);
|
||||
}
|
||||
|
||||
return _tasks;
|
||||
}
|
||||
|
||||
|
@ -108,15 +101,8 @@ const std::vector <Task>& TF2::get_tasks ()
|
|||
const std::vector <std::string>& TF2::get_lines ()
|
||||
{
|
||||
if (! _loaded_lines)
|
||||
{
|
||||
load_lines ();
|
||||
|
||||
// Apply previously added lines.
|
||||
std::vector <std::string>::iterator i;
|
||||
for (i = _added_lines.begin (); i != _added_lines.end (); ++i)
|
||||
_lines.push_back (*i);
|
||||
}
|
||||
|
||||
return _lines;
|
||||
}
|
||||
|
||||
|
|
|
@ -66,7 +66,6 @@ int CmdLog::execute (std::string& output)
|
|||
throw std::string (STRING_CMD_LOG_NO_WAITING);
|
||||
|
||||
context.tdb2.add (task);
|
||||
|
||||
context.footnote (onProjectChange (task));
|
||||
context.tdb2.commit ();
|
||||
|
||||
|
|
65
test/bug.899.t
Executable file
65
test/bug.899.t
Executable file
|
@ -0,0 +1,65 @@
|
|||
#! /usr/bin/perl
|
||||
################################################################################
|
||||
## taskwarrior - a command line task list manager.
|
||||
##
|
||||
## Copyright 2006-2012, Paul Beckingham, Federico Hernandez.
|
||||
##
|
||||
## Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
## of this software and associated documentation files (the "Software"), to deal
|
||||
## in the Software without restriction, including without limitation the rights
|
||||
## to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
## copies of the Software, and to permit persons to whom the Software is
|
||||
## furnished to do so, subject to the following conditions:
|
||||
##
|
||||
## The above copyright notice and this permission notice shall be included
|
||||
## in all copies or substantial portions of the Software.
|
||||
##
|
||||
## THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
## OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
## FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
## THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
## LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
## OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
## SOFTWARE.
|
||||
##
|
||||
## http://www.opensource.org/licenses/mit-license.php
|
||||
##
|
||||
################################################################################
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 6;
|
||||
|
||||
# Create the rc file.
|
||||
if (open my $fh, '>', 'bug.rc')
|
||||
{
|
||||
print $fh "data.location=.\n",
|
||||
"confirmation=off\n";
|
||||
close $fh;
|
||||
ok (-r 'bug.rc', 'Created bug.rc');
|
||||
}
|
||||
|
||||
# Bug 899: task log does not behave correctly when logging into a project
|
||||
my $output = qx{../src/task rc:bug.rc add one pro:A};
|
||||
like ($output, qr/ 0% complete \(1 of 1 /, '1 of 1 tasks remaining - 0%');
|
||||
|
||||
$output = qx{../src/task rc:bug.rc add two pro:A};
|
||||
like ($output, qr/ 0% complete \(2 of 2 /, '2 of 2 tasks remaining - 0%');
|
||||
|
||||
$output = qx{../src/task rc:bug.rc 1 done};
|
||||
like ($output, qr/ 50% complete \(1 of 2 /, '1 of 2 tasks remaining - 50%');
|
||||
|
||||
$output = qx{../src/task rc:bug.rc log three pro:A};
|
||||
like ($output, qr/ 66% complete \(1 of 3 /, '1 of 3 tasks remaining - 66%');
|
||||
|
||||
# Cleanup.
|
||||
unlink qw(pending.data completed.data undo.data backlog.data synch.key bug.rc);
|
||||
ok (! -r 'pending.data' &&
|
||||
! -r 'completed.data' &&
|
||||
! -r 'undo.data' &&
|
||||
! -r 'backlog.data' &&
|
||||
! -r 'synch.key' &&
|
||||
! -r 'bug.rc', 'Cleanup');
|
||||
|
||||
exit 0;
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue