Closed kodaxx closed 3 years ago
I believe I can fix this issue, but you'll have to deal with me on my git skills in regards to contributing. It will be good practice for me, as I usually just use git with my own projects.
Thanks @kodaxx, no problems at all. :)
Okay, after digging into this it seems that when you create a payment plan, the interval is saved in the DB in its plural form (Months
, for example)
https://github.com/membermatters/MemberMatters/blob/d0883d032b8c4b91e19a14c2d92888c2f1050a57/memberportal/api_admin_tools/models.py#L36
This means that the minPrice.interval
computed function always returns the plural form (Months
, for example)
(https://github.com/membermatters/MemberMatters/blob/main/frontend/src/components/Billing/TierCard.vue#L19)
Since the interval string's key in i18n is the singular, these two things are conflicting https://github.com/membermatters/MemberMatters/blob/main/frontend/src/i18n/en-AU/index.ts#L403
There's a few ways to go about this I think:
minPrice
returns, since they all end in s
- this feels hacky to me, but would work of courseWhich of these solutions is preferred to you? Do you think my findings are correct?
The issue is the same in both components, btw
There are plural and non plural versions in the i18n file. It looks like the db values are returning as capitalised strings so it's probably easiest to just call toLowerCase()
on the returned string (TierCard.vue#L19
) to make sure it's all lowercase, then the existing i18n definitions should work.
There are plural and non plural versions in the i18n file. It looks like the db values are returning as capitalised strings so it's probably easiest to just call
toLowerCase()
on the returned string (TierCard.vue#L19
) to make sure it's all lowercase, then the existing i18n definitions should work.![]()
I'm not sure this is the issue, as I see both plural and singular forms.
Either
paymentPlans.intervalPlurals.Months
is the key that's being computed
or
paymentPlans.interval.Months
is being computed.
Neither are correct, even in lowercase, because the key should be paymentPlans.intervalPlurals.month
, for example.
It's the 3rd level deep that is incorrect
The quick solution, and the one that causes the least possible disruption imo is to change the key to the plural form in the i18n file.
At that point we would do the toLowerCase()
in the component and it would be correct
Ahh sorry I missed that. Yeah it looks we need both a change to the i18n definitions and the returned value to be lowercased.
This whole section is probably due for a refactor anyway, as it's a little messy. ;)
Awesome! Okay that's what I thought, I just wanted to make sure we agree on the solution - will make that change and (attempt to) submit a pull request.
Side note: I don't see a dev
branch, should I PR to main?
Yep that's correct. Each release is tagged when I'm happy with the state of main. If/once more people start contributing this will probably change slightly, but that's how it is for now. :)
Fixed in #127
Ah I worked out why I didn't pick this up, I had faulty data in my dev database that means I didn't notice this :)
Ah I worked out why I didn't pick this up, I had faulty data in my dev database that means I didn't notice this :)
Make sense lol
I'll probably stick to some of the low hanging fruit until I'm more familiar with the codebase. Thanks for the merge!
Low hanging fruit is still fruit that needs to be picked so still appreciated ;) Cheers!
Description
The plan card/tier card components seems to have an error displaying the interval string correctly.
Instead of displaying
From $30.00 USD every 1 months
, it displaysFrom $30.00 USD every 1 paymentPlans.interval.Months
Affected components
It seems to be these components/lines
Example