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

automatic entry of 1 into first currency field #69

Closed
Baggydawg opened this issue Jun 19, 2020 · 3 comments
Closed

automatic entry of 1 into first currency field #69

Baggydawg opened this issue Jun 19, 2020 · 3 comments

Comments

@Baggydawg
Copy link

The typical finance terminology for foreign exchange would be: USD GBP

The assumption is obviously that the first currency is set to one, however the workflow requires me to type 1 each time for a conversion.

Would it be possible to update the workflow so it recognises the first item in the currency pair will be set to 1 should the user not specify otherwise?

@deanishe
Copy link
Owner

The typical finance terminology for foreign exchange would be: USD GBP

This isn't a "currency conversion" workflow, it's a "unit conversion" workflow. Currencies are just another unit, so FOREX conventions aren't really interesting for determining the workflow's behaviour.

@Baggydawg
Copy link
Author

That's true.

In which case if you wouldn't mind, could you point me to where in the code I could edit it myself?

I'd just add an if statement that passes undefined currency units e.g. 'usd eur' through to the same output as '1 usd eur'.

@deanishe
Copy link
Owner

deanishe commented Jul 10, 2020

I'd just add an if statement that passes undefined currency units e.g. 'usd eur' through to the same output as '1 usd eur'

It doesn't work that way. The input format is [context] number input-unit [output-unit], so you'd need to edit the query parser to catch a ValueError from Converter.parse_context() and do something like query = '1 ' + query. And that will only work if the first currency doesn't match a context the workflow understands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants