-
-
Notifications
You must be signed in to change notification settings - Fork 410
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
Customizable Host contributor information requirement #10935
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code looks clean, no blocker on my side 👍
if (selectedProfile) { | ||
totalAmount += selectedProfile.totalContributedToHost?.valueInCents || 0; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Potential edge case here: we theoretically support tiers that have a different currency than the collective. I'm ok with just documenting that in an issue if we don't have the appetite for it now.
totalAmount
is in tier currency, while totalContributedToHost
is in collective currency.
select *
from "Tiers" t
INNER JOIN "Collectives" c ON t."CollectiveId" = c.id
WHERE c."deletedAt" IS NULL
AND t."deletedAt" IS NULL
AND c.currency != t.currency
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not an issue, totalContributedToHost
is calculated using Transactions.amountInHostCurrency
and then converted to either collective or host currency (depending on what was requested).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, but the scenario I shared above is one where you have a USD collective with a JPY tier. In this case:
totalAmount
, which comes fromstepDetails
, will use the tier currency (JPY)totalContributedToHost
will be calculated in host currency, then converted in collective currency (USD)- As a consequence, this function will end up doing:
let totalAmount = getTotalYearlyAmount(stepDetails); // JPY5000
const selectedProfile = profiles.find(p => p.account.id === stepProfile?.id);
if (selectedProfile) {
// JPY5000 += USD100 || 0;
totalAmount += selectedProfile.totalContributedToHost?.valueInCents || 0;
}
Co-authored-by: Benjamin Piouffle <benjamin@opencollective.com>
Co-authored-by: Benjamin Piouffle <benjamin@opencollective.com>
f4fecb5
to
81c3b2e
Compare
Requires opencollective/opencollective-api#10661
Resolves opencollective/opencollective#7792
Resolves opencollective/opencollective#5092
Resolves opencollective/opencollective#5091