Skip to content

Commit

Permalink
Fix: updateContributorsWithReputation rep fallback values
Browse files Browse the repository at this point in the history
  • Loading branch information
rdig committed Jun 11, 2024
1 parent ad74dd6 commit bc4b327
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,8 @@ exports.handler = async (event) => {
const allNativeDomainIds =
data?.getColony?.domains?.items?.map(({ nativeId }) => nativeId) ?? [];

console.log({ allNativeDomainIds })

const promiseResults = await Promise.allSettled(
allNativeDomainIds.map(async (nativeDomainId) => {
const { skillId } = await colonyClient.getDomain(nativeDomainId);
Expand Down Expand Up @@ -181,6 +183,8 @@ exports.handler = async (event) => {

const totalAddresses = sortedAddresses.length;

console.log({ totalAddresses })

const promiseStatuses = await Promise.allSettled(
sortedAddresses.map(async ({ address, reputationBN }, idx) => {
const contributorAddress = getAddress(address);
Expand All @@ -189,12 +193,12 @@ exports.handler = async (event) => {
const colonyReputationPercentage = contributorRepDecimal
.mul(100)
.div(totalRepInColony.toString())
.toNumber();
.toNumber() || 0;

const domainReputationPercentage = contributorRepDecimal
.mul(100)
.div(totalRepInDomain.toString())
.toNumber();
.toNumber() || 0;

const contributorReputationId = `${colonyAddress}_${nativeDomainId}_${contributorAddress}`;
const colonyContributorId = `${colonyAddress}_${contributorAddress}`;
Expand Down Expand Up @@ -226,6 +230,8 @@ exports.handler = async (event) => {

const type = getContributorType(totalAddresses, idx, createdAt);

console.log({ type, colonyReputationPercentage, contributorAddress, contributorRepDecimal, domainReputationPercentage, reputation })

await updateColonyContributorInDb({
id: colonyContributorId,
type,
Expand Down

0 comments on commit bc4b327

Please sign in to comment.