AvatarHurden / keypirinha-currency

A currency converter plugin for Keypirinha
MIT License
30 stars 4 forks source link

Strange results when writing two currencies #7

Closed DrorHarari closed 5 years ago

DrorHarari commented 5 years ago

At this time, 10 EUR are 11.50 USD as below: image

When typing 10 usd eur we're getting as a result: image

Which I would have guessed means 10 US dollars as Euros, but what we see is the result of 11.15 USD which is like the calculation of 10 * EUR/USD which is very confusing (not good with money).

BTW, my current configuration is:

[defaults]
input_cur = USD
output_cur = USD
             EUR
             ILS
             GBP
             JPY
tchokido commented 5 years ago

where do you edit your preference for this plugin ?

AvatarHurden commented 5 years ago

@DrorHarari Actually, the plugin is calculating 10 USD + 1 EUR. This is because of the way I designed the grammar, making the addition or subtraction operator between currencies optional and, when there are no numbers provided, assuming you meant 1 of the currency.

Assuming 1 when no value is provided is good for showing exchange rates (EUR in USD), but can be confusing for this case. In the next version I'll probably make the operators between currencies mandatory (while still allowing something like 10 USD + EUR to be interpreted as 10 USD + 1 EUR) and make the final separator (in, to, etc) optional (which would allow 10 USD EUR to be interpreted as 10 USD in EUR).

I think this would be the best approach. Any thoughts?

@tchokido You can search for 'Configure currency' and there should be an item that opens up the configuration file.

More information can be found in this link.

DrorHarari commented 5 years ago

@AvatarHurden I was wondering what was the number I was getting... 8-)

Your suggestion makes perfect sense. I appreciate the insight and am thankful for the very useful extension!

/d

AvatarHurden commented 5 years ago

Version 2.1 changes the grammar and should be more intuitive. Let me know if you run into any other edge cases!