Skip to content

Commit 19cc5e4

Browse files
committed
Fix cursor direction
1 parent e9a25f7 commit 19cc5e4

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/Share/Postgres/Queries.hs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -719,8 +719,8 @@ listBranchesByProject limit mayCursor mayBranchNamePrefix mayContributorQuery ki
719719
where
720720
mkCursorFilter cursor = case cursor of
721721
Nothing -> mempty
722-
Just (Cursor (beforeTime, branchId) Previous) -> [PG.sql| AND (b.updated_at, b.id) < (#{beforeTime}, #{branchId})|]
723-
Just (Cursor (afterTime, branchId) Next) -> [PG.sql| AND (b.updated_at, b.id) > (#{afterTime}, #{branchId})|]
722+
Just (Cursor (afterTime, branchId) Previous) -> [PG.sql| AND (b.updated_at, b.id) > (#{afterTime}, #{branchId})|]
723+
Just (Cursor (beforeTime, branchId) Next) -> [PG.sql| AND (b.updated_at, b.id) < (#{beforeTime}, #{branchId})|]
724724
kindFilter = case kind of
725725
AllBranchKinds -> ""
726726
OnlyContributorBranches -> "AND b.contributor_id IS NOT NULL"
@@ -842,8 +842,8 @@ listContributorBranchesOfUserAccessibleToCaller contributorUserId mayCallerUserI
842842
Just (Query branchNamePrefix) -> [PG.sql| AND starts_with(b.name, #{branchNamePrefix}) |]
843843
mkCursorFilter cursor = case cursor of
844844
Nothing -> mempty
845-
Just (Cursor (beforeTime, branchId) Previous) -> [PG.sql| AND (b.updated_at, b.id) < (#{beforeTime}, #{branchId}) |]
846-
Just (Cursor (afterTime, branchId) Next) -> [PG.sql| AND (b.updated_at, b.id) > (#{afterTime}, #{branchId}) |]
845+
Just (Cursor (afterTime, branchId) Previous) -> [PG.sql| AND (b.updated_at, b.id) > (#{afterTime}, #{branchId}) |]
846+
Just (Cursor (beforeTime, branchId) Next) -> [PG.sql| AND (b.updated_at, b.id) < (#{beforeTime}, #{branchId}) |]
847847
projectFilter = case mayProjectId of
848848
Nothing -> mempty
849849
Just projId -> [PG.sql| AND b.project_id = #{projId} |]

0 commit comments

Comments
 (0)