hpdeifel / hledger-iadd

A terminal UI as drop-in replacement for hledger add.
BSD 3-Clause "New" or "Revised" License
77 stars 8 forks source link

wrong amount suggested when entering transaction #50

Closed RobertNielsen1 closed 3 years ago

RobertNielsen1 commented 3 years ago

If .hledger.journal consists of the following:

2021-01-29 Sal Income $-5,000.33 A $100.00 B $400.00 C $2,000.11 D $2,500.22

If you add an additional transaction, choosing "Sal," the program correctly gives the default accounts and amounts until you get to amount 3, corresponding to account B. At that point, it prompts:

Amount 3 ($4900.33):

There was a recent similar bug in hledger add, so that could be a clue if there was similar code shared.

Thank you!

Rob Nielsen

hpdeifel commented 3 years ago

Indeed, I can reproduce this. Thanks for the report!

hpdeifel commented 3 years ago

Should be fixed now

RobertNielsen1 commented 3 years ago

Thank you, and I am trying to get the latest version of iadd on my Mac. Currently, I have version 1.3.12.

The instructions on http://hackage.haskell.org/package/hledger-iadd say to type:

stack install --resolver=lts hledger-iadd-1.3.9

However, I assumed the instructions should actually be:

stack install --resolver=lts hledger-iadd-1.3.13

The first time I tried the above (i.e., what I thought should be the corrected version), it failed, suggesting that I add

- easytest-0.3@sha256:d4b776102cc8bfd62ec3a2e0e8e2b2c5796a323dab5ad866a32567512a76554a,3422

to stack.yaml under "extra-deps:," which I did.

I then tried the installation again, and got the following error code:

easytest                         > /private/var/folders/qf/mr_jmvrx63g1q2j3lgd6g8s80000gn/T/stack-2ae29108614bb3c0/easytest-0.3/src/EasyTest/Internal/Hedgehog.hs:40:24: error:
easytest                         >     • Couldn't match expected type ‘UseColor’
easytest                         >                   with actual type ‘Maybe UseColor’
easytest                         >     • In the second argument of ‘checkRegion’, namely ‘mcolor’
easytest                         >       In the expression: checkRegion region mcolor name 0 seed prop
easytest                         >       In an equation for ‘checkNamed’:
easytest                         >           checkNamed region mcolor name seed prop
easytest                         >             = checkRegion region mcolor name 0 seed prop
easytest                         >    |
easytest                         > 40 |   = checkRegion region mcolor name 0 seed prop
easytest                         >    |                        ^^^^^^
easytest                         >    
easytest                         > /private/var/folders/qf/mr_jmvrx63g1q2j3lgd6g8s80000gn/T/stack-2ae29108614bb3c0/easytest-0.3/src/EasyTest/Internal/Hedgehog.hs:46:39: error:
easytest                         >     • Couldn't match expected type ‘UseColor’
easytest                         >                   with actual type ‘Maybe UseColor’
easytest                         >     • In the first argument of ‘renderSummary’, namely ‘mcolor’
easytest                         >       In the second argument of ‘(=<<)’, namely
easytest                         >         ‘renderSummary mcolor summary’
easytest                         >       In a stmt of a 'do' block:
easytest                         >         setRegion sregion =<< renderSummary mcolor summary
easytest                         >    |
easytest                         > 46 |   setRegion sregion =<< renderSummary mcolor summary
easytest                         >    |                                       ^^^^^^

Any ideas for a next step?

Thank you!

Rob

hpdeifel commented 3 years ago

I was able to install it with stack by doing the following:

stack install --resolver=lts 'hledger-iadd-1.3.14'

and then adding the newerst hledger-lib to extra-deps, as suggested by stack

RobertNielsen1 commented 3 years ago

I was able to get it to work.

While the stack install kept failing, I switched to cabal, which created a working version. I then renamed the old hledger-iadd file in my .local/bin directory to something else. Then I copied the working hledger-iadd file from the .cabal/store/ghc-8.10.4/hldgr-dd-1.3.14-fea57338/bin directory to the .local/bin directory.

I am sure that there are more elegant ways to accomplish this, but it seems to have worked.

Also, I ran a quick check, and no more problems with the one entry that was previously causing a problem.

Many thanks for your updating the program! I can get back to moving forward on my iadd video!!

Rob

simonmichael commented 3 years ago

Tip: when stack install warns about missing extra-deps, you can often just add them to the command line.