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

support for OR operators #279

Closed
jellegerbrandy opened this issue Jul 3, 2019 · 6 comments
Closed

support for OR operators #279

jellegerbrandy opened this issue Jul 3, 2019 · 6 comments

Comments

@jellegerbrandy
Copy link
Contributor

ín the alchemy history page we concatenate the results of these two queries:

proposals {where: { stage_in: [IProposalStage.ExpiredInQueue, IProposalStage.Executed] } ...

proposals {where:  { stage: IProposalStage.Queued, expiresInQueueAt_lte: Math.floor(new Date().getTime() / 1000) }

The fact that these are two different queries makes sorting and paging very hard to implement, so we'd like to have one single query

@jellegerbrandy
Copy link
Contributor Author

following orens suggestion and looking here https://www.howtographql.com/react-apollo/7-filtering-searching-the-list-of-links/ I have tried:

{ daos (where: { OR: [
  {id:"0x86072cbff48da3c1f01824a6761a03f105bcc697"},
    {id:"0x86072cbff48da3c1f01824a6761a03f105bcc697"}  
]
}) { id, name}

{ name id
}}

Which gives me a syntax error.

@jellegerbrandy
Copy link
Contributor Author

This comment is relevant and probably applies to our situation as well: graphql/graphql-js#585 (comment)

@jellegerbrandy
Copy link
Contributor Author

while this query gives me no error,b ut ti just ignores the filter:

{ daos (filter: { OR: [
  {id:"0x86072cbff48da3c1f01824a6761a03f105bcc697"},
    {name: "Endemic Bunny"},
  
]}
)
  
  { name id 
}}

@jellegerbrandy
Copy link
Contributor Author

There is a possible workaround for this, for this specific history query.

we could run this query:

{ proposals (
  where: { 
    stage_in: ["ExpiredInQueue", "Executed", "Queued"] ,
    expiresInQueueAt_lte: $currentDate
}) 
  
  { id expiresInQueueAt
    stage
}}

Currently, this will not work, bc we may have Executed proposals that are not past their expiresInQueue data.
But if we chagne the subgraph, and set "expiresInQueueAt" to 0 (zero) for all proposals that are not Queued, this should give us exactly the proposals we want.

@orenyodfat
Copy link
Contributor

does using closingAt field https://github.com/daostack/subgraph/blob/master/src/domain/schema.graphql#L59 will do the work. ?

@jellegerbrandy
Copy link
Contributor Author

yesss

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

No branches or pull requests

2 participants