Skip to content

Commit

Permalink
fix data insertion for cluster matching
Browse files Browse the repository at this point in the history
  • Loading branch information
CarlosQ96 committed Jan 22, 2025
1 parent 734dbab commit 54fa338
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/adapters/cocmAdapter/cocmAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export class CocmAdapter implements CocmAdapterInterface {
i18n.__(translationErrorMessagesKeys.CLUSTER_MATCHING_API_ERROR),
);
}
return result.data;
return result.data.matching_data;
} catch (e) {
logger.error('clusterMatchingApi error', e);
throw new Error(
Expand Down
3 changes: 2 additions & 1 deletion src/services/cronJobs/syncEstimatedClusterMatchingJob.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ export const fetchAndUpdateClusterEstimatedMatching = async () => {
votes_data: clusterMatchingDonations,
strategy: defaultMatchingStrategy,
min_donation_threshold_amount: activeQfRound.minimumValidUsdValue,
matching_cap_amount: activeQfRound.allocatedFundUSD * activeQfRound.maximumReward,
matching_cap_amount:
activeQfRound.allocatedFundUSD * activeQfRound.maximumReward,
matching_amount: activeQfRound.allocatedFundUSD,
passport_threshold: activeQfRound.minimumPassportScore,
};
Expand Down
7 changes: 4 additions & 3 deletions src/workers/cocm/estimatedClusterMatchingWorker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,12 @@ const worker: EstimatedClusterMatchingWorker = {
const params: any[] = [];
const values = matchingData
.map((data, index) => {
const baseIndex = index * 3;
params.push(data.project_name, qfRoundId, data.matching_amount);
return `(
(SELECT id FROM project WHERE title = $${index * 3 + 1}),
$${index * 3 + 2},
$${index * 3 + 3}
(SELECT id FROM project WHERE title = $${baseIndex + 1}),
$${baseIndex + 2},
$${baseIndex + 3}
)`;
})
.join(',');
Expand Down

0 comments on commit 54fa338

Please sign in to comment.