BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
4280575f
Commit
4280575f
authored
May 30, 2016
by
DJ Mountney
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move filtering todos by projects not pending deletion into a scope on the todo model
parent
4ecc10fa
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
7 deletions
+2
-7
todos_finder.rb
app/finders/todos_finder.rb
+1
-7
todo.rb
app/models/todo.rb
+1
-0
No files found.
app/finders/todos_finder.rb
View file @
4280575f
...
...
@@ -23,13 +23,7 @@ class TodosFinder
end
def
execute
items
=
current_user
.
todos
# Filter out todos linked to project pending deletion
items
=
items
.
joins
(
'INNER JOIN projects ON projects.id = todos.project_id AND projects.pending_delete = false'
)
items
=
current_user
.
todos
.
not_pending_delete
items
=
by_action_id
(
items
)
items
=
by_author
(
items
)
items
=
by_project
(
items
)
...
...
app/models/todo.rb
View file @
4280575f
...
...
@@ -19,6 +19,7 @@ class Todo < ActiveRecord::Base
scope
:pending
,
->
{
with_state
(
:pending
)
}
scope
:done
,
->
{
with_state
(
:done
)
}
scope
:not_pending_delete
,
->
{
joins
(
'INNER JOIN projects ON projects.id = todos.project_id AND projects.pending_delete = false'
)
}
state_machine
:state
,
initial: :pending
do
event
:done
do
...
...
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