Skip to content

Commit

Permalink
Navigate proposal next/prev by sequence order (#1108)
Browse files Browse the repository at this point in the history
  • Loading branch information
jace authored Apr 22, 2021
1 parent 13d44ec commit 26df27d
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions funnel/models/proposal.py
Original file line number Diff line number Diff line change
Expand Up @@ -517,21 +517,21 @@ def update_description(self) -> None:

def getnext(self):
return (
Proposal.query.filter(Proposal.project == self.project)
.filter(Proposal.id != self.id)
.filter(Proposal._state == self.state.value)
.filter(Proposal.created_at < self.created_at)
.order_by(db.desc('created_at'))
Proposal.query.filter(
Proposal.project == self.project,
Proposal.seq > self.seq,
)
.order_by(Proposal.seq.asc())
.first()
)

def getprev(self):
return (
Proposal.query.filter(Proposal.project == self.project)
.filter(Proposal.id != self.id)
.filter(Proposal._state == self.state.value)
.filter(Proposal.created_at > self.created_at)
.order_by('created_at')
Proposal.query.filter(
Proposal.project == self.project,
Proposal.seq < self.seq,
)
.order_by(Proposal.seq.desc())
.first()
)

Expand Down

0 comments on commit 26df27d

Please sign in to comment.