Skip to content

Commit 9f47421

Browse files
committed
Use a then b and reverse instead of b then a for PR sorting
1 parent 1030ae1 commit 9f47421

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/utils/sort_queue.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,12 @@ pub fn sort_queue_prs(mut prs: Vec<PullRequestModel>) -> Vec<PullRequestModel> {
1515
// 3. Compare approval status (approved PRs should come first)
1616
.then_with(|| a.is_approved().cmp(&b.is_approved()).reverse())
1717
// 4. Compare priority numbers (higher priority should come first)
18-
.then_with(|| b.priority.unwrap_or(0).cmp(&a.priority.unwrap_or(0)))
18+
.then_with(|| {
19+
a.priority
20+
.unwrap_or(0)
21+
.cmp(&b.priority.unwrap_or(0))
22+
.reverse()
23+
})
1924
// 5. Compare rollup mode (-1 = never/iffy, 0 = maybe, 1 = always)
2025
.then_with(|| {
2126
get_rollup_priority(a.rollup.as_ref()).cmp(&get_rollup_priority(b.rollup.as_ref()))

0 commit comments

Comments
 (0)