From 489d69ae271bc2d7abff6b30dc7f9d4e0f0c7de6 Mon Sep 17 00:00:00 2001 From: Mahdi Date: Wed, 30 Oct 2024 23:01:45 +0330 Subject: [PATCH 1/4] modify test-snapshot --- src/utils/badges/test-snapshots.ts | 59 ++++++++++++++++++++---------- 1 file changed, 39 insertions(+), 20 deletions(-) diff --git a/src/utils/badges/test-snapshots.ts b/src/utils/badges/test-snapshots.ts index a376eb9..4c20932 100644 --- a/src/utils/badges/test-snapshots.ts +++ b/src/utils/badges/test-snapshots.ts @@ -7,9 +7,10 @@ export const testAddresses: RawSnapshotPoint[] = [ delegatePoints: 0, badgeholderPoints: 1, holderType: 'Silver', + recipientsPoints: '', delegateType: null, holderAmount: 7200, - delegateAmount: 0, + delegateAmount: 0, badgeholderType: "Citizen", }, { User: '0x143c777F650aD8D00942D497EE66f4D774427195', @@ -20,7 +21,8 @@ export const testAddresses: RawSnapshotPoint[] = [ holderType: 'Bronze', delegateType: null, holderAmount: 7200, - delegateAmount: 0, + delegateAmount: 0, badgeholderType: "Citizen", + recipientsPoints: '', }, { User: '0x316131DC685A63B1dbC8E0Fc6B893ec51CF159DA', @@ -31,7 +33,8 @@ export const testAddresses: RawSnapshotPoint[] = [ holderType: null, delegateType: null, holderAmount: 0, - delegateAmount: 0, + delegateAmount: 0, badgeholderType: "Citizen", + recipientsPoints: '', }, { User: '0x393053056EB678EA95CBc67CB7E1198184984707', @@ -42,7 +45,8 @@ export const testAddresses: RawSnapshotPoint[] = [ holderType: null, delegateType: null, holderAmount: 0, - delegateAmount: 0, + delegateAmount: 0, badgeholderType: "Citizen", + recipientsPoints: '', }, { User: '0xc0f2A154abA3f12D71AF25e87ca4f225B9C52203', @@ -53,7 +57,8 @@ export const testAddresses: RawSnapshotPoint[] = [ holderType: null, delegateType: null, holderAmount: 0, - delegateAmount: 0, + delegateAmount: 0, badgeholderType: "Citizen", + recipientsPoints: '', }, { User: '0xcd192b61a8Dd586A97592555c1f5709e032F2505', @@ -64,7 +69,8 @@ export const testAddresses: RawSnapshotPoint[] = [ holderType: null, delegateType: null, holderAmount: 0, - delegateAmount: 0, + delegateAmount: 0, badgeholderType: "Citizen", + recipientsPoints: '', }, { User: '0xA1179f64638adb613DDAAc32D918EB6BEB824104', @@ -75,7 +81,8 @@ export const testAddresses: RawSnapshotPoint[] = [ holderType: null, delegateType: null, holderAmount: 0, - delegateAmount: 0, + delegateAmount: 0, badgeholderType: "Citizen", + recipientsPoints: '', }, { User: '0x6eb78c56F639b3d161456e9f893c8e8aD9d754F0', @@ -86,7 +93,8 @@ export const testAddresses: RawSnapshotPoint[] = [ holderType: null, delegateType: null, holderAmount: 0, - delegateAmount: 0, + delegateAmount: 0, badgeholderType: "Citizen", + recipientsPoints: '', }, { User: '0xD5db3F8B0a236176587460dC85F0fC5705D78477', @@ -97,7 +105,8 @@ export const testAddresses: RawSnapshotPoint[] = [ holderType: null, delegateType: null, holderAmount: 0, - delegateAmount: 0, + delegateAmount: 0, badgeholderType: "Citizen", + recipientsPoints: '', }, { User: '0xe1e5dcbbc95aabe80e2f9c65c7a2cef85daf61c4', @@ -108,7 +117,8 @@ export const testAddresses: RawSnapshotPoint[] = [ holderType: null, delegateType: null, holderAmount: 0, - delegateAmount: 0, + delegateAmount: 0, badgeholderType: "Citizen", + recipientsPoints: '', }, { User: '0x33878e070db7f70D2953Fe0278Cd32aDf8104572', @@ -119,7 +129,8 @@ export const testAddresses: RawSnapshotPoint[] = [ holderType: null, delegateType: null, holderAmount: 0, - delegateAmount: 0, + delegateAmount: 0, badgeholderType: "Citizen", + recipientsPoints: '', }, { User: '0xB9573982875b83aaDc1296726E2ae77D13D9B98F', @@ -130,7 +141,8 @@ export const testAddresses: RawSnapshotPoint[] = [ holderType: null, delegateType: null, holderAmount: 0, - delegateAmount: 0, + delegateAmount: 0, badgeholderType: "Citizen", + recipientsPoints: '', }, { User: '0x9FE099C5234E873551Fec5c7dd06E5213360A46c', @@ -141,7 +153,8 @@ export const testAddresses: RawSnapshotPoint[] = [ holderType: null, delegateType: null, holderAmount: 0, - delegateAmount: 0, + delegateAmount: 0, badgeholderType: "Citizen", + recipientsPoints: '', }, { User: '0x44AC194359fA44eCe6Cb2E53E8c90547BCCb95a0', @@ -152,7 +165,8 @@ export const testAddresses: RawSnapshotPoint[] = [ holderType: null, delegateType: null, holderAmount: 0, - delegateAmount: 0, + delegateAmount: 0, badgeholderType: "Citizen", + recipientsPoints: '', }, { User: '0x7F37e3008207C27360b20ABCFB5fdCc8e37596B8', @@ -163,40 +177,44 @@ export const testAddresses: RawSnapshotPoint[] = [ holderType: null, delegateType: null, holderAmount: 0, - delegateAmount: 0, + delegateAmount: 0, badgeholderType: "Citizen", + recipientsPoints: '', }, { User: '0x871Cd6353B803CECeB090Bb827Ecb2F361Db81AB', holderPoints: 0, delegatePoints: 0, - badgeholderPoints: 0, holderType: null, delegateType: null, holderAmount: 0, - delegateAmount: 0, + delegateAmount: 0, + badgeholderType: "Citizen", + recipientsPoints: '', }, { User: '0x523E41A134Ab0999F2dC844eA02d9b53cC28fD1a', holderPoints: 3, delegatePoints: 1, - badgeholderPoints: 1, holderType: 'Gold', delegateType: 'Silver', holderAmount: 1000, delegateAmount: 250, + recipientsPoints: '', + badgeholderType: "Guest" }, { User: '0xA602BBA404f3EEA8231398Df0CFA78B46550331d', holderPoints: 0, delegatePoints: 5, - badgeholderPoints: 0, holderType: 'Silver', delegateType: 'Silver', holderAmount: 0, delegateAmount: 2500, + recipientsPoints: '', + badgeholderType: "Guest" }, { User: '0x501EcB2eD1BAFeEDCB122B321618044C07e6C324', @@ -207,6 +225,7 @@ export const testAddresses: RawSnapshotPoint[] = [ holderType: null, delegateType: null, holderAmount: 0, - delegateAmount: 0, + delegateAmount: 0, badgeholderType: "Citizen", + recipientsPoints: '', }, ]; From 489cc2b8c7ef1706431fc21df69177eb595cef67 Mon Sep 17 00:00:00 2001 From: Mahdi Date: Thu, 31 Oct 2024 00:52:38 +0330 Subject: [PATCH 2/4] Fix budget min-max --- src/flow/dto/bodies.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/flow/dto/bodies.ts b/src/flow/dto/bodies.ts index 880093f..f282f8f 100644 --- a/src/flow/dto/bodies.ts +++ b/src/flow/dto/bodies.ts @@ -110,8 +110,8 @@ export class IsPositiveNumberArray implements ValidatorConstraintInterface { export class BudgetDto { @IsPositive() - @Min(2_000_000) - @Max(8_000_000) + @Min(1_100_000) + @Max(3_500_000) @IsDefined() @ApiProperty() budget: number; From 8fd464f1bb2061b55812df795b0f8c7bb1195b8a Mon Sep 17 00:00:00 2001 From: Mahdi Date: Thu, 31 Oct 2024 13:19:15 +0330 Subject: [PATCH 3/4] Fix cois in the ballot list --- src/flow/flow.controller.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/flow/flow.controller.ts b/src/flow/flow.controller.ts index ce87c73..e1003ea 100644 --- a/src/flow/flow.controller.ts +++ b/src/flow/flow.controller.ts @@ -228,9 +228,15 @@ export class FlowController { ) { if (!collectionId) throw new BadRequestException('You need to supply a collection id'); - const [ranking, state] = await Promise.all([ + const [ranking, state, cois] = await Promise.all([ this.flowService.getRanking(userId, collectionId), this.flowService.getCollectionProgressStatus(userId, collectionId), + this.prismaService.projectCoI.findMany({ + where: { + userId, + project: {parentId: collectionId}, + } + }) ]); if (state !== 'Attested' && state !== 'Finished') { @@ -246,10 +252,12 @@ export class FlowController { const ballot: AgoraBallotPost = { projects: [] }; + const isCoi = (projectId: number) => cois.findIndex((el) => el.projectId === projectId) !== -1 + ballot.projects = ranking.map((el) => ({ project_id: el.project.RF6Id!, allocation: (el.share * 100).toFixed(3), - impact: el.stars === null ? 3 : el.stars, + impact: isCoi(el.projectId) ? 0 : el.stars === null ? 3 : el.stars, })); return ballot; From fae35a768fec710c06e62bd00ab44a550441db8d Mon Sep 17 00:00:00 2001 From: Mahdi Date: Thu, 31 Oct 2024 17:44:36 +0330 Subject: [PATCH 4/4] Increase threshold --- src/flow/flow.controller.ts | 9 +++++---- src/flow/flow.service.ts | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/flow/flow.controller.ts b/src/flow/flow.controller.ts index e1003ea..d70a0de 100644 --- a/src/flow/flow.controller.ts +++ b/src/flow/flow.controller.ts @@ -234,9 +234,9 @@ export class FlowController { this.prismaService.projectCoI.findMany({ where: { userId, - project: {parentId: collectionId}, - } - }) + project: { parentId: collectionId }, + }, + }), ]); if (state !== 'Attested' && state !== 'Finished') { @@ -252,7 +252,8 @@ export class FlowController { const ballot: AgoraBallotPost = { projects: [] }; - const isCoi = (projectId: number) => cois.findIndex((el) => el.projectId === projectId) !== -1 + const isCoi = (projectId: number) => + cois.findIndex((el) => el.projectId === projectId) !== -1; ballot.projects = ranking.map((el) => ({ project_id: el.project.RF6Id!, diff --git a/src/flow/flow.service.ts b/src/flow/flow.service.ts index 21202c7..413dab6 100644 --- a/src/flow/flow.service.ts +++ b/src/flow/flow.service.ts @@ -759,7 +759,7 @@ export class FlowService { allProjects, ); - const progress = Math.min(1, realProgress * 10); + const progress = Math.min(1, realProgress * 3); if (progress === 1) { if (collection) {