Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
755205f6
Commit
755205f6
authored
Jul 22, 2021
by
Alexandru Croitor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make iterations finder ordering deterministic
parent
7678d206
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
4 deletions
+3
-4
ee/app/finders/iterations_finder.rb
ee/app/finders/iterations_finder.rb
+1
-2
ee/spec/finders/iterations_finder_spec.rb
ee/spec/finders/iterations_finder_spec.rb
+2
-2
No files found.
ee/app/finders/iterations_finder.rb
View file @
755205f6
...
...
@@ -82,8 +82,7 @@ class IterationsFinder
# rubocop: disable CodeReuse/ActiveRecord
def
order
(
items
)
order_statement
=
Gitlab
::
Database
.
nulls_last_order
(
'due_date'
,
'ASC'
)
items
.
reorder
(
order_statement
).
order
(
:title
)
items
.
reorder
(
:due_date
).
order
(
:title
,
{
id: :asc
})
end
# rubocop: enable CodeReuse/ActiveRecord
...
...
ee/spec/finders/iterations_finder_spec.rb
View file @
755205f6
...
...
@@ -66,8 +66,8 @@ RSpec.describe IterationsFinder do
expect
(
subject
).
to
contain_exactly
(
root_closed_iteration
,
root_group_iteration
,
closed_iteration
,
started_group_iteration
,
upcoming_group_iteration
)
end
it
'orders iterations by due date'
do
expect
(
subject
.
to_a
).
to
eq
([
closed_iteration
,
root_closed_iteration
,
started_group_iteration
,
root_group_iteration
,
upcoming_group_iteration
])
it
'orders iterations by due date
and title
'
do
expect
(
subject
.
to_a
).
to
eq
([
closed_iteration
,
root_closed_iteration
,
started_group_iteration
,
root_group_iteration
,
upcoming_group_iteration
]
.
sort_by
{
|
a
|
[
a
.
due_date
,
a
.
title
,
a
.
id
]
}
)
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment