Feat/relevance threshold route#226
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
pikonha
left a comment
There was a problem hiding this comment.
some things to consider, nothing to block it
apps/dispatcher/src/services/triggers/vote-confirmation-trigger.service.ts
Show resolved
Hide resolved
| const keep = await Promise.all( | ||
| data.map(async (event) => { | ||
| const type = event.changeType.toUpperCase(); | ||
| if (!Object.values(FeedEventType).includes(type as FeedEventType)) return true; | ||
|
|
||
| const threshold = await this.thresholdRepository.getThreshold(event.daoId, type as FeedEventType); | ||
| return threshold === null || Math.abs(Number(event.delta)) >= Number(threshold); | ||
| }) | ||
| ); | ||
|
|
||
| return data.filter((_, i) => keep[i]); |
There was a problem hiding this comment.
couldn't this be added to the votes endpoint query? i.e, votes(fromDelta: <vote high relevance>)
we currently don't have it supported, but it would be a piece of cake to add it
There was a problem hiding this comment.
On votes, yes!
But on this case, (voting power changes), it would not work. The flow here is:
- fetch ALL vp changes;
- loop -> filter considering the event type (delegation or transfer).
As the threshold could be different for each type, we cannot filter on the query. We need to get all, then filter locally. The other option would be to use "relevance" as a query parameter, then the api filter on the repo-layer (but it looks ugly).
Summary
GetEventRelevanceThresholdGraphQL query and threshold repository to fetch relevance thresholds from the anticapture APITest plan