Skip to content

Commit

Permalink
fix: better ordering of proposals in home page (#130)
Browse files Browse the repository at this point in the history
* fix: better ordering of proposals in home page

* chore:linting
  • Loading branch information
clockworkgr authored Sep 16, 2024
1 parent a60045d commit 6b58f40
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 223 deletions.
20 changes: 10 additions & 10 deletions src/gql/gql.ts

Large diffs are not rendered by default.

212 changes: 5 additions & 207 deletions src/gql/graphql.ts

Large diffs are not rendered by default.

7 changes: 6 additions & 1 deletion src/graphql/proposalsActive.graphql
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
query ProposalsActive($limit: Int!, $offset: Int!, $where: proposal_bool_exp = {}) {
all_proposals: proposal(order_by: { active_first_order: asc }, limit: $limit, offset: $offset, where: $where) {
all_proposals: proposal(
order_by: [{ active_first_order: asc }, { id: desc }]
limit: $limit
offset: $offset
where: $where
) {
content
deposit_end_time
description
Expand Down
7 changes: 6 additions & 1 deletion src/graphql/proposalsFailed.graphql
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
query ProposalsFailed($limit: Int!, $offset: Int!, $where: proposal_bool_exp = {}) {
all_proposals: proposal(order_by: { failed_first_order: asc }, limit: $limit, offset: $offset, where: $where) {
all_proposals: proposal(
order_by: [{ failed_first_order: asc }, { id: desc }]
limit: $limit
offset: $offset
where: $where
) {
content
deposit_end_time
description
Expand Down
7 changes: 6 additions & 1 deletion src/graphql/proposalsPassed.graphql
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
query ProposalsPassed($limit: Int!, $offset: Int!, $where: proposal_bool_exp = {}) {
all_proposals: proposal(order_by: { passed_first_order: asc }, limit: $limit, offset: $offset, where: $where) {
all_proposals: proposal(
order_by: [{ passed_first_order: asc }, { id: desc }]
limit: $limit
offset: $offset
where: $where
) {
content
deposit_end_time
description
Expand Down
7 changes: 6 additions & 1 deletion src/graphql/proposalsRejected.graphql
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
query ProposalsRejected($limit: Int!, $offset: Int!, $where: proposal_bool_exp = {}) {
all_proposals: proposal(order_by: { rejected_first_order: asc }, limit: $limit, offset: $offset, where: $where) {
all_proposals: proposal(
order_by: [{ rejected_first_order: asc }, { id: desc }]
limit: $limit
offset: $offset
where: $where
) {
content
deposit_end_time
description
Expand Down
11 changes: 9 additions & 2 deletions src/graphql/proposalsSearch.graphql
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
query ProposalsSearch($limit: Int!, $offset: Int!, $searchString: String!) {
all_proposals: proposal(order_by: { active_first_order: asc }, limit: $limit, offset: $offset, where: {_or: [{title: {_ilike: $searchString}},{description: {_ilike: $searchString}}]}) {
all_proposals: proposal(
order_by: [{ active_first_order: asc }, { id: desc }]
limit: $limit
offset: $offset
where: { _or: [{ title: { _ilike: $searchString } }, { description: { _ilike: $searchString } }] }
) {
content
deposit_end_time
description
Expand All @@ -21,7 +26,9 @@ query ProposalsSearch($limit: Int!, $offset: Int!, $searchString: String!) {
voting_end_time
voting_start_time
}
proposal_aggregate(where: {_or: [{title: {_ilike: $searchString}},{description: {_ilike: $searchString}}]}) {
proposal_aggregate(
where: { _or: [{ title: { _ilike: $searchString } }, { description: { _ilike: $searchString } }] }
) {
aggregate {
count
}
Expand Down

0 comments on commit 6b58f40

Please sign in to comment.