From c93f3bdef6c5cc097a79129e7c4c9de02b09dc8e Mon Sep 17 00:00:00 2001 From: Carlos Fontes Date: Tue, 10 Dec 2024 12:09:29 +0000 Subject: [PATCH] fixes --- .../components/SplitPayoutBeneficiaryForm.tsx | 19 ++++++------------- .../utils/autocalculateMultiPayout.ts | 6 ++---- .../SubmissionsListPage/SubmissionCard.tsx | 7 +++++-- 3 files changed, 13 insertions(+), 19 deletions(-) diff --git a/packages/web/src/pages/CommitteeTools/PayoutsTool/components/PayoutAllocation/SplitPayoutAllocation/components/SplitPayoutBeneficiaryForm.tsx b/packages/web/src/pages/CommitteeTools/PayoutsTool/components/PayoutAllocation/SplitPayoutAllocation/components/SplitPayoutBeneficiaryForm.tsx index ed89d529c..aec422109 100644 --- a/packages/web/src/pages/CommitteeTools/PayoutsTool/components/PayoutAllocation/SplitPayoutAllocation/components/SplitPayoutBeneficiaryForm.tsx +++ b/packages/web/src/pages/CommitteeTools/PayoutsTool/components/PayoutAllocation/SplitPayoutAllocation/components/SplitPayoutBeneficiaryForm.tsx @@ -165,6 +165,10 @@ export const SplitPayoutBeneficiaryForm = ({ ]; }; + const selectedSubmission = isPayoutCreated + ? beneficiaries[index]?.decryptedSubmission ?? beneficiarySubmission! + : beneficiarySubmission!; + return (
{index + 1}.
@@ -179,19 +183,8 @@ export const SplitPayoutBeneficiaryForm = ({ isPayoutCreated ? beneficiaries[index]?.decryptedSubmission ?? beneficiarySubmission! : beneficiarySubmission! } ghIssue={ - getGhIssueFromSubmission( - isPayoutCreated - ? beneficiaries[index]?.decryptedSubmission ?? beneficiarySubmission! - : beneficiarySubmission!, - vaultGithubIssues - ) || - getGhPRFromSubmission( - isPayoutCreated - ? beneficiaries[index]?.decryptedSubmission ?? beneficiarySubmission! - : beneficiarySubmission!, - vaultGithubPRs, - vaultGithubIssues - ) + getGhIssueFromSubmission(selectedSubmission, vaultGithubIssues) || + getGhPRFromSubmission(selectedSubmission, vaultGithubPRs, vaultGithubIssues) } />
diff --git a/packages/web/src/pages/CommitteeTools/PayoutsTool/utils/autocalculateMultiPayout.ts b/packages/web/src/pages/CommitteeTools/PayoutsTool/utils/autocalculateMultiPayout.ts index 8e9ef0948..9316667b6 100644 --- a/packages/web/src/pages/CommitteeTools/PayoutsTool/utils/autocalculateMultiPayout.ts +++ b/packages/web/src/pages/CommitteeTools/PayoutsTool/utils/autocalculateMultiPayout.ts @@ -99,8 +99,6 @@ export const autocalculateMultiPayoutPointingSystem = ( if (!constraints || !constraints.length) return undefined; if (!beneficiaries || beneficiaries.length === 0) return undefined; - console.log({ beneficiaries, constraints, totalAmountToPay, maxCapPerPoint }); - const beneficiariesCalculated = [] as IBeneficiaryWithCalcs[]; const needPoints = beneficiaries.every((ben) => ben.percentageOfPayout === "" || ben.percentageOfPayout === undefined); @@ -114,8 +112,8 @@ export const autocalculateMultiPayoutPointingSystem = ( let totalMultiplier = 0; - if (beneficiary.ghIssue?.labels.includes("complete-fix")) totalMultiplier += BONUS_POINTS_CONSTRAINTS.fix; - if (beneficiary.ghIssue?.labels.includes("complete-test")) totalMultiplier += BONUS_POINTS_CONSTRAINTS.test; + if (beneficiary.ghIssue?.labels?.includes("complete-fix")) totalMultiplier += BONUS_POINTS_CONSTRAINTS.fix; + if (beneficiary.ghIssue?.labels?.includes("complete-test")) totalMultiplier += BONUS_POINTS_CONSTRAINTS.test; const complementaryPoints = totalMultiplier * +mainIssuePoints; diff --git a/packages/web/src/pages/CommitteeTools/SubmissionsTool/SubmissionsListPage/SubmissionCard.tsx b/packages/web/src/pages/CommitteeTools/SubmissionsTool/SubmissionsListPage/SubmissionCard.tsx index fdd74bb57..895503b80 100644 --- a/packages/web/src/pages/CommitteeTools/SubmissionsTool/SubmissionsListPage/SubmissionCard.tsx +++ b/packages/web/src/pages/CommitteeTools/SubmissionsTool/SubmissionsListPage/SubmissionCard.tsx @@ -37,7 +37,11 @@ export const SubmissionCard = ({ const commChannel = submissionData?.communicationChannel; const severityColors = getSeveritiesColorsArray(vault); - const isComplementary = !!(ghIssue as GithubPR)?.linkedIssueNumber; + const isGithubPR = (issue: GithubIssue | GithubPR): issue is GithubPR => { + return "linkedIssueNumber" in issue; + }; + + const isComplementary = ghIssue ? isGithubPR(ghIssue) && !!ghIssue.linkedIssueNumber : false; const createdAt = new Date(+submission?.createdAt * 1000); @@ -85,7 +89,6 @@ export const SubmissionCard = ({ const getText = () => { const labels = (ghIssue as GithubPR).labels; if (labels.includes("complete-fix") && labels.includes("complete-test")) { - console.log(ghIssue); return `COMPLETE (fix & test) -> ${(ghIssue as GithubPR).linkedIssue?.severity}`; } else if (labels.includes("complete-fix")) { return `COMPLETE (fix) -> ${(ghIssue as GithubPR).linkedIssue?.severity}`;