-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: store proposal, vote and follower count on space #292
Conversation
Need to update the schema.sql on the hub with the new columns, and reflect it to |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files📢 Thoughts on this report? Let us know! |
…abs/snapshot-sequencer into fabien/space-counters
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tAck, but need one more, as I made some edit
@ChaituVR What's blocking here ? |
await db.queryAsync( | ||
'UPDATE spaces SET proposal_count = (SELECT count(id) from proposals WHERE space = spaces.id)' | ||
); | ||
|
||
await db.queryAsync( | ||
'UPDATE spaces SET follower_count = (SELECT count(id) from follows WHERE space = spaces.id)' | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if these work correctly 🤔 @wa0x6e you tried?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, they should work
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Working :D i was confused
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tAck
I've created 3 new columns on the "spaces" table,
proposal_count
,vote_count
andfollower_count
, this get automatically updated if some action happening on the space, this will allows us later to remove some heavy queries that we have currently on the hub.