- TW-257 limit: not working properly (thanks to Aikido Guy).
This commit is contained in:
Paul Beckingham 2014-07-04 11:26:49 -04:00
parent 7ac533a82d
commit 222c357c0a
2 changed files with 10 additions and 2 deletions

View file

@ -47,6 +47,7 @@
Harlan).
- TW-255 'Mask' instead of 'iMask' shown in info report (thanks to Benjamin
Weber)
- TW-257 limit: not working properly (thanks to Aikido Guy).
- TW-259 Hyphenated words are split when added (thanks to Ben Boeckel).
- TW-261 Easy to create "not deletable" task (thanks to Jan Kunder).
- TW-266 Allow project auto-completion to search completed tasks (thanks to

View file

@ -53,8 +53,11 @@ int CmdExport::execute (std::string& output)
std::vector <Task> filtered;
filter.subset (filtered);
// Note: "limit:" feature not supported.
// TODO Why not?
// Obey 'limit:N'.
int rows = 0;
int lines = 0;
context.getLimits (rows, lines);
int limit = (rows > lines ? rows : lines);
// Is output contained within a JSON array?
bool json_array = context.config.getBoolean ("json.array");
@ -63,6 +66,7 @@ int CmdExport::execute (std::string& output)
if (json_array)
output += "[\n";
int counter = 0;
std::vector <Task>::iterator task;
for (task = filtered.begin (); task != filtered.end (); ++task)
{
@ -70,6 +74,9 @@ int CmdExport::execute (std::string& output)
output += ",\n";
output += task->composeJSON (true);
if (limit && ++counter >= limit)
break;
}
if (filtered.size ())