Skip to content

Commit

Permalink
Merge branch 'master' of github.com:Giveth/impact-graph
Browse files Browse the repository at this point in the history
  • Loading branch information
mohammadranjbarz committed Oct 18, 2024
2 parents f3b067d + b4fada0 commit cc77c53
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 8 deletions.
7 changes: 4 additions & 3 deletions src/repositories/projectRepository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,13 +209,14 @@ export const filterProjectsQuery = (params: FilterProjectQueryInputParams) => {
break;
case SortingField.InstantBoosting: // This is our default sorting
query
.addOrderBy('project.isGivbackEligible', 'DESC') // Primary sorting condition
.addOrderBy('project.verified', 'DESC') // Secondary sorting condition
.addOrderBy(
'projectInstantPower.totalPower',
OrderDirection.DESC,
'NULLS LAST',
);
)
.addOrderBy('project.isGivbackEligible', 'DESC') // Primary sorting condition
.addOrderBy('project.verified', 'DESC'); // Secondary sorting condition

if (isFilterByQF) {
query.addOrderBy(
'project.sumDonationValueUsdForActiveQfRound',
Expand Down
19 changes: 16 additions & 3 deletions src/resolvers/projectResolver.allProject.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -550,12 +550,25 @@ function allProjectsTestCases() {
const user1 = await saveUserDirectlyToDb(generateRandomEtheriumAddress());
const user2 = await saveUserDirectlyToDb(generateRandomEtheriumAddress());

const project1 = await saveProjectDirectlyToDb(createProjectData());
const project2 = await saveProjectDirectlyToDb(createProjectData());
const project3 = await saveProjectDirectlyToDb(createProjectData());
const project1 = await saveProjectDirectlyToDb({
...createProjectData(),
verified: true,
isGivbackEligible: true,
});
const project2 = await saveProjectDirectlyToDb({
...createProjectData(),
verified: true,
isGivbackEligible: false,
});
const project3 = await saveProjectDirectlyToDb({
...createProjectData(),
verified: true,
isGivbackEligible: true,
});
const project4 = await saveProjectDirectlyToDb({
...createProjectData(),
verified: false,
isGivbackEligible: false,
}); // Not boosted -Not verified project
await saveProjectDirectlyToDb(createProjectData()); // Not boosted project

Expand Down
4 changes: 2 additions & 2 deletions test/pre-test-scripts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ import { ProjectActualMatchingViewV161717646612482 } from '../migration/17176466
import { LastSnapshotProjectPowerViewV21717648491606 } from '../migration/1717648491606-LastSnapshotProjectPowerView_V2';
import { ProjectFuturePowerViewV21717643016553 } from '../migration/1717643016553-ProjectFuturePowerView_V2';
import { ProjectUserInstantPowerViewV21717644442966 } from '../migration/1717644442966-ProjectUserInstantPowerView_V2';
import { ProjectInstantPowerViewV21717648653115 } from '../migration/1717648653115-ProjectInstantPowerView_V2';
import { UserProjectPowerViewV21717645768886 } from '../migration/1717645768886-UserProjectPowerView_V2';
import { ProjectGivbackRankViewV31725260193333 } from '../migration/1725260193333-projectGivbackRankView';
import { ProjectInstantPowerViewV31724223781248 } from '../migration/1724223781248-ProjectInstantPowerViewV3';

async function seedDb() {
await seedUsers();
Expand Down Expand Up @@ -538,7 +538,7 @@ async function runMigrations() {
queryRunner,
);
await new createOrganisatioTokenTable1646302349926().up(queryRunner);
await new ProjectInstantPowerViewV21717648653115().up(queryRunner);
await new ProjectInstantPowerViewV31724223781248().up(queryRunner);
await new ProjectEstimatedMatchingViewV21717646357435().up(queryRunner);
await new ProjectUserInstantPowerViewV21717644442966().up(queryRunner);
await new TakePowerBoostingSnapshotProcedureSecondVersion1690723242749().up(
Expand Down

0 comments on commit cc77c53

Please sign in to comment.