Skip to content

Commit

Permalink
Merge pull request #60 from GeneralMagicio/rf6-staging
Browse files Browse the repository at this point in the history
Rf6 staging
  • Loading branch information
mmahdigh authored Oct 31, 2024
2 parents 2ec3633 + fae35a7 commit 8169ca3
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 25 deletions.
4 changes: 2 additions & 2 deletions src/flow/dto/bodies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
13 changes: 11 additions & 2 deletions src/flow/flow.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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') {
Expand All @@ -246,10 +252,13 @@ 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;
Expand Down
2 changes: 1 addition & 1 deletion src/flow/flow.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
59 changes: 39 additions & 20 deletions src/utils/badges/test-snapshots.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -20,7 +21,8 @@ export const testAddresses: RawSnapshotPoint[] = [
holderType: 'Bronze',
delegateType: null,
holderAmount: 7200,
delegateAmount: 0,
delegateAmount: 0, badgeholderType: "Citizen",
recipientsPoints: '',
},
{
User: '0x316131DC685A63B1dbC8E0Fc6B893ec51CF159DA',
Expand All @@ -31,7 +33,8 @@ export const testAddresses: RawSnapshotPoint[] = [
holderType: null,
delegateType: null,
holderAmount: 0,
delegateAmount: 0,
delegateAmount: 0, badgeholderType: "Citizen",
recipientsPoints: '',
},
{
User: '0x393053056EB678EA95CBc67CB7E1198184984707',
Expand All @@ -42,7 +45,8 @@ export const testAddresses: RawSnapshotPoint[] = [
holderType: null,
delegateType: null,
holderAmount: 0,
delegateAmount: 0,
delegateAmount: 0, badgeholderType: "Citizen",
recipientsPoints: '',
},
{
User: '0xc0f2A154abA3f12D71AF25e87ca4f225B9C52203',
Expand All @@ -53,7 +57,8 @@ export const testAddresses: RawSnapshotPoint[] = [
holderType: null,
delegateType: null,
holderAmount: 0,
delegateAmount: 0,
delegateAmount: 0, badgeholderType: "Citizen",
recipientsPoints: '',
},
{
User: '0xcd192b61a8Dd586A97592555c1f5709e032F2505',
Expand All @@ -64,7 +69,8 @@ export const testAddresses: RawSnapshotPoint[] = [
holderType: null,
delegateType: null,
holderAmount: 0,
delegateAmount: 0,
delegateAmount: 0, badgeholderType: "Citizen",
recipientsPoints: '',
},
{
User: '0xA1179f64638adb613DDAAc32D918EB6BEB824104',
Expand All @@ -75,7 +81,8 @@ export const testAddresses: RawSnapshotPoint[] = [
holderType: null,
delegateType: null,
holderAmount: 0,
delegateAmount: 0,
delegateAmount: 0, badgeholderType: "Citizen",
recipientsPoints: '',
},
{
User: '0x6eb78c56F639b3d161456e9f893c8e8aD9d754F0',
Expand All @@ -86,7 +93,8 @@ export const testAddresses: RawSnapshotPoint[] = [
holderType: null,
delegateType: null,
holderAmount: 0,
delegateAmount: 0,
delegateAmount: 0, badgeholderType: "Citizen",
recipientsPoints: '',
},
{
User: '0xD5db3F8B0a236176587460dC85F0fC5705D78477',
Expand All @@ -97,7 +105,8 @@ export const testAddresses: RawSnapshotPoint[] = [
holderType: null,
delegateType: null,
holderAmount: 0,
delegateAmount: 0,
delegateAmount: 0, badgeholderType: "Citizen",
recipientsPoints: '',
},
{
User: '0xe1e5dcbbc95aabe80e2f9c65c7a2cef85daf61c4',
Expand All @@ -108,7 +117,8 @@ export const testAddresses: RawSnapshotPoint[] = [
holderType: null,
delegateType: null,
holderAmount: 0,
delegateAmount: 0,
delegateAmount: 0, badgeholderType: "Citizen",
recipientsPoints: '',
},
{
User: '0x33878e070db7f70D2953Fe0278Cd32aDf8104572',
Expand All @@ -119,7 +129,8 @@ export const testAddresses: RawSnapshotPoint[] = [
holderType: null,
delegateType: null,
holderAmount: 0,
delegateAmount: 0,
delegateAmount: 0, badgeholderType: "Citizen",
recipientsPoints: '',
},
{
User: '0xB9573982875b83aaDc1296726E2ae77D13D9B98F',
Expand All @@ -130,7 +141,8 @@ export const testAddresses: RawSnapshotPoint[] = [
holderType: null,
delegateType: null,
holderAmount: 0,
delegateAmount: 0,
delegateAmount: 0, badgeholderType: "Citizen",
recipientsPoints: '',
},
{
User: '0x9FE099C5234E873551Fec5c7dd06E5213360A46c',
Expand All @@ -141,7 +153,8 @@ export const testAddresses: RawSnapshotPoint[] = [
holderType: null,
delegateType: null,
holderAmount: 0,
delegateAmount: 0,
delegateAmount: 0, badgeholderType: "Citizen",
recipientsPoints: '',
},
{
User: '0x44AC194359fA44eCe6Cb2E53E8c90547BCCb95a0',
Expand All @@ -152,7 +165,8 @@ export const testAddresses: RawSnapshotPoint[] = [
holderType: null,
delegateType: null,
holderAmount: 0,
delegateAmount: 0,
delegateAmount: 0, badgeholderType: "Citizen",
recipientsPoints: '',
},
{
User: '0x7F37e3008207C27360b20ABCFB5fdCc8e37596B8',
Expand All @@ -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',
Expand All @@ -207,6 +225,7 @@ export const testAddresses: RawSnapshotPoint[] = [
holderType: null,
delegateType: null,
holderAmount: 0,
delegateAmount: 0,
delegateAmount: 0, badgeholderType: "Citizen",
recipientsPoints: '',
},
];

0 comments on commit 8169ca3

Please sign in to comment.