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
c96e1556
Commit
c96e1556
authored
Sep 21, 2020
by
Jarka Košanová
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix filtering epics when sorting by dates
- use cte optimisation for searching by start_date and due_date
parent
037cc07e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
1 deletion
+25
-1
changelogs/unreleased/230827-fix-epics-filter.yml
changelogs/unreleased/230827-fix-epics-filter.yml
+5
-0
ee/app/models/ee/epic.rb
ee/app/models/ee/epic.rb
+14
-0
ee/spec/finders/epics_finder_spec.rb
ee/spec/finders/epics_finder_spec.rb
+6
-1
No files found.
changelogs/unreleased/230827-fix-epics-filter.yml
0 → 100644
View file @
c96e1556
---
title
:
Fix filtering epics when sorting by dates
merge_request
:
42827
author
:
type
:
fixed
ee/app/models/ee/epic.rb
View file @
c96e1556
...
...
@@ -144,6 +144,8 @@ module EE
end
class_methods
do
extend
::
Gitlab
::
Utils
::
Override
# We support internal references (&epic_id) and cross-references (group.full_path&epic_id)
#
# Escaped versions with `&` will be extracted too
...
...
@@ -199,6 +201,18 @@ module EE
end
end
override
:simple_sorts
def
simple_sorts
super
.
merge
(
{
'start_date_asc'
=>
->
{
order_start_date_asc
.
with_order_id_desc
},
'start_date_desc'
=>
->
{
order_start_date_desc
.
with_order_id_desc
},
'end_date_asc'
=>
->
{
order_end_date_asc
.
with_order_id_desc
},
'end_date_desc'
=>
->
{
order_end_date_desc
.
with_order_id_desc
}
}
)
end
def
parent_class
::
Group
end
...
...
ee/spec/finders/epics_finder_spec.rb
View file @
c96e1556
...
...
@@ -7,7 +7,7 @@ RSpec.describe EpicsFinder do
let_it_be
(
:search_user
)
{
create
(
:user
)
}
let_it_be
(
:group
)
{
create
(
:group
,
:private
)
}
let_it_be
(
:another_group
)
{
create
(
:group
)
}
let_it_be
(
:epic1
)
{
create
(
:epic
,
:opened
,
group:
group
,
title:
'This is awesome epic'
,
created_at:
1
.
week
.
ago
)
}
let_it_be
(
:epic1
)
{
create
(
:epic
,
:opened
,
group:
group
,
title:
'This is awesome epic'
,
created_at:
1
.
week
.
ago
,
end_date:
10
.
days
.
ago
)
}
let_it_be
(
:epic2
)
{
create
(
:epic
,
:opened
,
group:
group
,
created_at:
4
.
days
.
ago
,
author:
user
,
start_date:
2
.
days
.
ago
,
end_date:
3
.
days
.
from_now
)
}
let_it_be
(
:epic3
)
{
create
(
:epic
,
:closed
,
group:
group
,
description:
'not so awesome'
,
start_date:
5
.
days
.
ago
,
end_date:
3
.
days
.
ago
)
}
let_it_be
(
:epic4
)
{
create
(
:epic
,
:closed
,
group:
another_group
)
}
...
...
@@ -471,6 +471,11 @@ RSpec.describe EpicsFinder do
expect
(
filtered_epics
).
to
contain_exactly
(
labeled_epic
)
end
it
'filters correctly by short expressions when sorting by due date'
do
expect
(
epics
(
attempt_group_search_optimizations:
true
,
search:
'aw'
,
sort:
'end_date_desc'
))
.
to
eq
([
epic3
,
epic1
])
end
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