-
Notifications
You must be signed in to change notification settings - Fork 15
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
How should I convert new units #27
Comments
Because I don’t have any experience in programming, I hope you can explain in detail how I can operate or modify your workflow if you can help me. Thanks again! |
There are 2 ways to add new units to the system.
When editing the convert.Unit(
id='dollar',
name='Dollar',
annotations=['$', 'dollar'],
conversion_params=('0', '0', '1', '0'),
).register(units)
convert.Unit(
id='paypal-fee',
name='PayPal fee',
base_unit='dollar',
conversion_params=('0.3', '0.044', '1', '0'), Note: the conversion params work like this: Perhaps I'll add something in the future to make this easier, but for now that's the only option. You're the first to ask for a custom unit :) |
It seems I somehow missed your reply... sorry about that In any case, it looks like my example was a bit too limited to work. I've tried a little more and I've come up with this code: params = dict(
units=units,
quantity_types=['money'],
base_unit='dollar',
)
add = 0.3
fee = 4.4
multiplier = fee * 0.0105
convert.Unit(
id='dollar',
name='Dollar',
annotations=['$', 'dollar'],
conversion_params=('0', '1', '1', '0'),
**params
).register(units)
convert.Unit(
id='paypal-fee',
name='PayPal fee',
annotations=['pp', 'paypal'],
conversion_params=('-%s' % add, '1', str(multiplier), '0'),
**params
).register(units)
convert.Unit(
id='paypal-total',
name='PayPal Total',
annotations=['pt'],
conversion_params=('-%s' % add, '1', str(1 + multiplier), '0'),
**params
).register(units) If needed you can easily change the 4.4% and +0.3. Note that after editing the code you will have to delete the |
thank you very much for your help!
This is indeed very practical to me, thanks again!
…On Sat, 17 Oct 2020 at 07:40, Rick van Hattem ***@***.***> wrote:
It seems I somehow missed your reply... sorry about that
In any case, it looks like my example was a bit too limited to work. I've
tried a little more and I've come up with this code:
params = dict(
units=units,
quantity_types=['money'],
base_unit='dollar',
)
add = 0.3
fee = 4.4
multiplier = fee * 0.0105
convert.Unit(
id='dollar',
name='Dollar',
annotations=['$', 'dollar'],
conversion_params=('0', '1', '1', '0'),
**params
).register(units)
convert.Unit(
id='paypal-fee',
name='PayPal fee',
annotations=['pp', 'paypal'],
conversion_params=('-%s' % add, '1', str(multiplier), '0'),
**params
).register(units)
convert.Unit(
id='paypal-total',
name='PayPal Total',
annotations=['pt'],
conversion_params=('-%s' % add, '1', str(1 + multiplier), '0'),
**params
).register(units)
If needed you can easily change the 4.4% and +0.3. Note that after editing
the code you will have to delete the units.pickle file which caches the
calculations.
This is how it looks right now:
[image: image]
<https://user-images.githubusercontent.com/270571/96322509-a269c680-1019-11eb-9dca-fbb6b6ae1c6f.png>
—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
<#27 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AQWTXPSE4EK73OQMZVMVZBTSLDKWHANCNFSM4QIHQDPQ>
.
|
Since I need to calculate a lot of PP transfer fee every day, I want to use Alfred to quickly calculate the PP fee result. How can I implement this conversion procedure in your workflow?
The PP fee calculation tool I currently use is shown in the link, and the US dollar is needed. The specific value set is 4.4%+0.3USD
![image](https://user-images.githubusercontent.com/70073278/90963728-d11d6200-e4ec-11ea-806a-42d961917641.png)
https://www.clothnappytree.com/ppcalculator/
Thanks for your help!
The text was updated successfully, but these errors were encountered: