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: filter votes by choice #712

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open

Conversation

wa0x6e
Copy link
Contributor

@wa0x6e wa0x6e commented Oct 14, 2023

Another implementation of #571

Add choice_in filter to Vote, allowing query such as

query Vote {
  votes(where: {choice_in: [15]}) {
    id
    choice
  }
}

Other changes

  • Refactor moderation and spaces cache to run only when called, for easier tests

Notes

It is impossible to add an INDEX on the choice JSON column, as the stored data format is not consistent, and can be either an INT, an array of INT, or an Object.

The filter should ideally be used only along some other filter, such as proposal id, etc ... to filter down the results first

@codecov
Copy link

codecov bot commented Oct 14, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (2d4c97e) 2.40% compared to head (4fa8baf) 16.84%.

Additional details and impacted files
@@             Coverage Diff             @@
##           master     #712       +/-   ##
===========================================
+ Coverage    2.40%   16.84%   +14.44%     
===========================================
  Files          39       39               
  Lines        2037     2048       +11     
  Branches       37       75       +38     
===========================================
+ Hits           49      345      +296     
+ Misses       1951     1671      -280     
+ Partials       37       32        -5     
Files Coverage Δ
src/graphql/operations/votes.ts 63.63% <100.00%> (+63.63%) ⬆️
src/helpers/spaces.ts 26.98% <100.00%> (+26.98%) ⬆️

... and 3 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@wa0x6e wa0x6e changed the title Add choice in to vote where Add choice_in filter to vote Oct 14, 2023
@wa0x6e wa0x6e changed the title Add choice_in filter to vote feat: filter votes by choice Oct 14, 2023
@wa0x6e wa0x6e marked this pull request as ready for review October 15, 2023 03:11
src/index.ts Outdated Show resolved Hide resolved
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.

2 participants