Skip to content

Commit

Permalink
[dsolonenko#143] Write payee for transfers in CSV export
Browse files Browse the repository at this point in the history
As far as tests go, I decided to only update the expected result(-s)
without updating any of the actuals. In particular:
- should_export_regular_transfer did not have a payee in its test transaction,
  so it stayed the same
- should_export_split_transfer had a payee, meaning the export result should
  have it as well from now on
  • Loading branch information
dtruebin committed Jul 26, 2020
1 parent 95aa8a3 commit e117881
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,13 @@ private void writeLine(Csv.Writer w, Transaction t) {
Category category = getCategoryById(t.categoryId);
Project project = getProjectById(t.projectId);
Account fromAccount = getAccount(t.fromAccountId);
Payee payee = getPayee(t.payeeId);
if (t.isTransfer()) {
Account toAccount = getAccount(t.toAccountId);
writeLine(w, dt, fromAccount.title, t.fromAmount, fromAccount.currency.id, 0, 0, category, null, TRANSFER_OUT, project, t.note);
writeLine(w, dt, toAccount.title, t.toAmount, toAccount.currency.id, 0, 0, category, null, TRANSFER_IN, project, t.note);
writeLine(w, dt, fromAccount.title, t.fromAmount, fromAccount.currency.id, 0, 0, category, payee, TRANSFER_OUT, project, t.note);
writeLine(w, dt, toAccount.title, t.toAmount, toAccount.currency.id, 0, 0, category, payee, TRANSFER_IN, project, t.note);
} else {
MyLocation location = getLocationById(t.locationId);
Payee payee = getPayee(t.payeeId);
writeLine(w, dt, fromAccount.title, t.fromAmount, fromAccount.currency.id, t.originalFromAmount, t.originalCurrencyId,
category, payee, location, project, t.note);
if (category != null && category.isSplit() && options.exportSplits) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ public void should_export_split_transfer() throws Exception {
.create();
assertEquals(
"2011-08-03,22:34:55,My Cash Account,-5.00,SGD,\"\",\"\",SPLIT,\"\",P1,Home,R1,My note\n"+
"~,\"\",My Cash Account,-5.00,SGD,\"\",\"\",\"\",\"\",\"\",Transfer Out,<NO_PROJECT>,\n"+
"~,\"\",My Bank Account,1.00,CZK,\"\",\"\",\"\",\"\",\"\",Transfer In,<NO_PROJECT>,\n",
"~,\"\",My Cash Account,-5.00,SGD,\"\",\"\",\"\",\"\",P1,Transfer Out,<NO_PROJECT>,\n"+
"~,\"\",My Bank Account,1.00,CZK,\"\",\"\",\"\",\"\",P1,Transfer In,<NO_PROJECT>,\n",
exportAsString(options));
}

Expand Down

0 comments on commit e117881

Please sign in to comment.