Skip to content
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

Merged
merged 27 commits into from
Jul 8, 2024

Conversation

bonustrack
Copy link
Member

@bonustrack bonustrack commented Feb 24, 2024

I've created 3 new columns on the "spaces" table, proposal_count, vote_count and follower_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.

@bonustrack bonustrack requested review from wa0x6e and ChaituVR and removed request for wa0x6e February 24, 2024 16:33
@wa0x6e
Copy link
Contributor

wa0x6e commented Feb 24, 2024

Need to update the schema.sql on the hub with the new columns, and reflect it to ./test/schema.sql

src/writer/follow.ts Outdated Show resolved Hide resolved
src/writer/proposal.ts Outdated Show resolved Hide resolved
src/writer/vote.ts Outdated Show resolved Hide resolved
src/writer/unfollow.ts Outdated Show resolved Hide resolved
src/writer/delete-proposal.ts Outdated Show resolved Hide resolved
Copy link

codecov bot commented Feb 26, 2024

Codecov Report

Attention: Patch coverage is 28.57143% with 30 lines in your changes missing coverage. Please review.

Files Patch % Lines
src/writer/unfollow.ts 8.33% 11 Missing ⚠️
src/writer/delete-proposal.ts 0.00% 7 Missing ⚠️
src/writer/vote.ts 0.00% 7 Missing ⚠️
src/writer/follow.ts 54.54% 5 Missing ⚠️
Additional details and impacted files

📢 Thoughts on this report? Let us know!

@wa0x6e wa0x6e requested a review from ChaituVR May 26, 2024 00:03
Copy link
Contributor

@wa0x6e wa0x6e left a 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

scripts/refresh_spaces_counters.ts Outdated Show resolved Hide resolved
scripts/refresh_spaces_counters.ts Outdated Show resolved Hide resolved
@wa0x6e wa0x6e requested a review from ChaituVR June 2, 2024 20:21
@wa0x6e
Copy link
Contributor

wa0x6e commented Jun 30, 2024

@ChaituVR What's blocking here ?

Comment on lines +23 to +29
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)'
);
Copy link
Member

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?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, they should work

Copy link
Member

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

Copy link
Member

@ChaituVR ChaituVR left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tAck

@ChaituVR ChaituVR merged commit 2869080 into master Jul 8, 2024
2 checks passed
@ChaituVR ChaituVR deleted the fabien/space-counters branch July 8, 2024 08:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants