Skip to content

Commit

Permalink
Fix formatting of posting when no amount was entered (#42)
Browse files Browse the repository at this point in the history
  • Loading branch information
chvp authored Sep 15, 2023
1 parent fa3c33d commit c2682dc
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions app/src/main/java/be/chvp/nanoledger/ui/add/AddViewModel.kt
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,16 @@ class AddViewModel @Inject constructor(
}
transaction.append(" ${payee.value}")
if (note.value!! != "") {
transaction.append("| ${note.value}")
transaction.append(" | ${note.value}")
}
transaction.append('\n')
// Drop last element, it should always be an empty posting
for (posting in postings.value!!.dropLast(1)) {
if (preferencesDataSource.getCurrencyBeforeAmount()) {
if (posting.third == "") {
transaction.append(
" ${posting.first}\n"
)
} else if (preferencesDataSource.getCurrencyBeforeAmount()) {
transaction.append(
" ${posting.first} ${posting.second} ${posting.third}\n"
)
Expand Down

0 comments on commit c2682dc

Please sign in to comment.