Fix query string for select account

A wrong query string was generated by "select account": one ansify_if()
too much was listed and justify() was called with the wrong parameters.

Bug fix for #744
This commit is contained in:
Martin Michlmayr 2014-05-30 22:01:08 -04:00
parent b2b84f35b4
commit dfcbbd169e
2 changed files with 20 additions and 20 deletions

View file

@ -291,17 +291,17 @@ value_t select_command(call_scope_t& args)
thus_far += "int(payee_width) + 1";
}
else if (ident == "account") {
formatter << "ansify_if("
<< "ansify_if(";
formatter << "ansify_if(";
if (accounts_report) {
formatter << "ansify_if(";
formatter << "partial_account(options.flat), blue if color),";
} else {
formatter << "justify(truncated(";
as_expr(column)->print(formatter);
formatter << ", int(account_width), int(abbrev_len)),"
<< "int(account_width)),";
formatter << "true, color),";
<< "int(account_width), -1, ";
formatter << "false, color),";
if (! thus_far.empty())
thus_far += " + ";

View file

@ -16,32 +16,32 @@
F
test select "date, account, amount" from posts
12-Feb-28 E  20.00 EUR
12-Feb-28 F  -20.00 EUR
12-Feb-29 Test  10.01 EUR
12-Feb-29 F  -10.01 EUR
12-Mar-24 C  30.00 EUR
12-Mar-24 D  -30.00 EUR
12-Mar-25 E  40.00 GBP
12-Mar-25 F  -40.00 GBP
12-Feb-28 E 20.00 EUR
12-Feb-28 F -20.00 EUR
12-Feb-29 Test 10.01 EUR
12-Feb-29 F -10.01 EUR
12-Mar-24 C 30.00 EUR
12-Mar-24 D -30.00 EUR
12-Mar-25 E 40.00 GBP
12-Mar-25 F -40.00 GBP
end test
test select "date, account, amount from posts where account =~ /^e/"
12-Feb-28 E  20.00 EUR
12-Mar-25 E  40.00 GBP
12-Feb-28 E 20.00 EUR
12-Mar-25 E 40.00 GBP
end test
test select "date, account, amount from posts where account =~ /e/"
12-Feb-28 E  20.00 EUR
12-Feb-29 Test  10.01 EUR
12-Mar-25 E  40.00 GBP
12-Feb-28 E 20.00 EUR
12-Feb-29 Test 10.01 EUR
12-Mar-25 E 40.00 GBP
end test
; leave out "from posts" since it is the default
test select "date, account, amount where account =~ /e/"
12-Feb-28 E  20.00 EUR
12-Feb-29 Test  10.01 EUR
12-Mar-25 E  40.00 GBP
12-Feb-28 E 20.00 EUR
12-Feb-29 Test 10.01 EUR
12-Mar-25 E 40.00 GBP
end test
test select "date, payee, amount from posts where account =~ /e/ and commodity =~ /GBP/"