Skip to content

Commit

Permalink
chore: add and sort strategies by verifiedSpaceCount
Browse files Browse the repository at this point in the history
  • Loading branch information
bonustrack committed Sep 27, 2024
1 parent 35a1df6 commit c764455
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/helpers/strategies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ async function loadStrategies() {
ids.forEach(id => {
if (res[id]) {
res[id].spacesCount = (res[id].spacesCount || 0) + 1;

if (space.verified) {
res[id].verifiedSpacesCount = (res[id].verifiedSpacesCount || 0) + 1;
}
}
});
});
Expand All @@ -40,9 +44,10 @@ async function loadStrategies() {
.map((strategy: any) => {
strategy.id = strategy.key;
strategy.spacesCount = strategy.spacesCount || 0;
strategy.verifiedSpacesCount = strategy.verifiedSpacesCount || 0;
return strategy;
})
.sort((a, b): any => b.spacesCount - a.spacesCount);
.sort((a, b): any => b.verifiedSpacesCount - a.verifiedSpacesCount);

strategiesObj = Object.fromEntries(
strategies.map(strategy => [strategy.id, strategy])
Expand Down

0 comments on commit c764455

Please sign in to comment.