Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hledger add does not record currency in transactions, even if a default is set #815

Closed
bertiebaggio opened this issue Jun 18, 2018 · 8 comments
Labels
A-BUG Something wrong, confusing or sub-standard in the software, docs, or user experience. add docs Documentation-related.

Comments

@bertiebaggio
Copy link

bertiebaggio commented Jun 18, 2018

Currently, the docs for add say:

Features:
...

  • If the journal defines a default commodity, it will be added to any bare numbers entered.

However, as of 1.9 this does not seem to be the case:

dionysus:tmp bertieb$ echo "D £1,000.00" >> mwe.journal

dionysus:tmp bertieb$ ~/.local/bin/hledger add -f mwe.journal 
Adding transactions to journal file /private/tmp/mwe.journal
Any command line arguments will be used as defaults.
Use tab key to complete, readline keys to edit, enter to accept defaults.
An optional (CODE) may follow transaction dates.
An optional ; COMMENT may follow descriptions or amounts.
If you make a mistake, enter < at any prompt to restart the transaction.
To end a transaction, enter . when prompted.
To quit, enter . at a date prompt or press control-d or control-c.
Date [2018/06/18]: 
Description: Widget Co
Account 1: assets:checking
Amount  1: -20
Account 2: expenses:widgets
Amount  2 [20]: 
Account 3 (or . or enter to finish this transaction): .
2018/06/18 Widget Co
    assets:checking              -20
    expenses:widgets              20

Save this transaction to the journal ? [y]: 
Saved.
Starting the next transaction (. or ctrl-D/ctrl-C to quit)
Date [2018/06/18]: .


dionysus:tmp bertieb$ less mwe.journal 
D £1,000.00

2018/06/18 Widget Co
    assets:checking              -20
    expenses:widgets              20

Thinking aloud, which way hledger add works (commodity vs none) is probably an orthogonal issue; though it would be nice to have a way to set if a default currency is recorded in add-ed transactions.

I could also see an argument for pulling the currency (if set) from the previous transaction / matched transaction; similar to how hledger add currently does for account 'default'/autocompletion.

For comparison, I have been using vim-ledger, which has been including the currencies in transactions- I would need to check to see if this has been due to a commodity directive (Edit: nope, seems I manually set let g:ledger_default_commodity = '£' in my .vimrc).

@simonmichael simonmichael added A-WISH Some kind of improvement request, hare-brained proposal, or plea. add help wanted needs:discussion To unblock: needs more discussion/review/exploration needs:design To unblock: needs more thought/planning, leading to a spec/plan labels Jun 21, 2018
@simonmichael simonmichael added docs Documentation-related. A-BUG Something wrong, confusing or sub-standard in the software, docs, or user experience. and removed needs:discussion To unblock: needs more discussion/review/exploration needs:design To unblock: needs more thought/planning, leading to a spec/plan A-WISH Some kind of improvement request, hare-brained proposal, or plea. labels Jan 4, 2024
simonmichael added a commit that referenced this issue Jan 4, 2024
@simonmichael
Copy link
Owner

simonmichael commented Jan 4, 2024

@bertiebaggio, thanks for your hledger bug report back in 2018. I miscategorised it as a wish, but as you said, the docs have been saying all along that this works. Now fixed in master. (And perhaps after next release we'll hear from add users impacted by this change - all testing welcome.)

@bertiebaggio
Copy link
Author

Thanks for following up on this- I haven't interacted with the project on GH or IRC/matrix in a while, but it is good to see development continues, your work is much appreciated :)

@simonmichael
Copy link
Owner

I suspect one use case was people who use a D directive, and don't want currency symbols appearing in their journal. Perhaps it will need to be an add option...

@simonmichael
Copy link
Owner

simonmichael commented Jan 5, 2024

In fact now that I think about it, wouldn't this be the normal situation ? If you're using D you probably aren't writing symbols in the journal, so why would you expect add to write symbols ?

@bertiebaggio
Copy link
Author

bertiebaggio commented Jan 5, 2024

That is a fair point, let me share my view too: the ledger format is excellent because it human-readable, and (to me) that means entries should be denoted with whatever currency symbol[s] the transaction was conducted in. Someone should be able to glance at/grep/extract an entry and have enough information to understand it on its own merits. There is, I think, a minor cognitive load benefit to looking at numbers and knowing, "these numbers are to do with money".†

That's my view, I can see someone else thinking "I know all my transactions are denoted in EUR, I don't need the symbol for each one". Presumably real-world physical ledgers elided currency symbols? Not that in itself is a reason to!

I don't mind which way you adjudicate this, I leave the decision in your capable hands :)


†: Maybe when I was a kid I heard the response "20 what? 20 bananas??" one time too many from physics teachers stressing the importance of units...

@simonmichael
Copy link
Owner

It makes sense to me, so I think I'll revert this and fix the doc instead, with an explanation.

@simonmichael
Copy link
Owner

simonmichael commented Jan 5, 2024

Just saw your reply @bertiebaggio. I think:

  • If the user wants currency symbols on their amounts, they will not use a D directive, and they will be ok with writing it when they enter amounts with add. [And they can enforce this with check or -s.]

  • If they don't want to type the (main) currency symbol, they can declare it as the default, and then omit it both when editing the journal and when using add.

There's a third case where user wants currency symbols everywhere in the journal, but wants to save the effort of typing it repeatedly when using add. I think this is a small enough use case it can be ignored. [Even if their commodity symbol is long.. because one can generally tab-complete the amount and then edit the number, avoiding retyping the symbol.]

@simonmichael
Copy link
Owner

I'm not a regular add user myself. So people who are can feel free to add their thoughts here.

simonmichael added a commit that referenced this issue Jan 5, 2024
…per docs, 2 [#815]"

This reverts commit 87600e5, which had a wrong description.
adept pushed a commit to adept/hledger that referenced this issue Mar 8, 2024
adept pushed a commit to adept/hledger that referenced this issue Mar 8, 2024
…per docs, 2 [simonmichael#815]"

This reverts commit 87600e5, which had a wrong description.
adept pushed a commit to adept/hledger that referenced this issue Mar 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-BUG Something wrong, confusing or sub-standard in the software, docs, or user experience. add docs Documentation-related.
Projects
None yet
Development

No branches or pull requests

2 participants