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
0
Merge Requests
0
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
Léo-Paul Géneau
gitlab-ce
Commits
4ad028ae
Commit
4ad028ae
authored
Aug 17, 2016
by
Ahmad Sherif
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename TodoService#mark_todos_as_done_by_id{,s}
parent
548da42b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
5 deletions
+5
-5
app/controllers/dashboard/todos_controller.rb
app/controllers/dashboard/todos_controller.rb
+1
-1
app/services/todo_service.rb
app/services/todo_service.rb
+2
-2
spec/services/todo_service_spec.rb
spec/services/todo_service_spec.rb
+2
-2
No files found.
app/controllers/dashboard/todos_controller.rb
View file @
4ad028ae
...
@@ -6,7 +6,7 @@ class Dashboard::TodosController < Dashboard::ApplicationController
...
@@ -6,7 +6,7 @@ class Dashboard::TodosController < Dashboard::ApplicationController
end
end
def
destroy
def
destroy
TodoService
.
new
.
mark_todos_as_done_by_id
([
params
[
:id
]],
current_user
)
TodoService
.
new
.
mark_todos_as_done_by_id
s
([
params
[
:id
]],
current_user
)
respond_to
do
|
format
|
respond_to
do
|
format
|
format
.
html
{
redirect_to
dashboard_todos_path
,
notice:
'Todo was successfully marked as done.'
}
format
.
html
{
redirect_to
dashboard_todos_path
,
notice:
'Todo was successfully marked as done.'
}
...
...
app/services/todo_service.rb
View file @
4ad028ae
...
@@ -142,10 +142,10 @@ class TodoService
...
@@ -142,10 +142,10 @@ class TodoService
# When user marks some todos as done
# When user marks some todos as done
def
mark_todos_as_done
(
todos
,
current_user
)
def
mark_todos_as_done
(
todos
,
current_user
)
mark_todos_as_done_by_id
(
todos
.
select
(
&
:id
),
current_user
)
mark_todos_as_done_by_id
s
(
todos
.
select
(
&
:id
),
current_user
)
end
end
def
mark_todos_as_done_by_id
(
ids
,
current_user
)
def
mark_todos_as_done_by_id
s
(
ids
,
current_user
)
todos
=
current_user
.
todos
.
where
(
id:
ids
)
todos
=
current_user
.
todos
.
where
(
id:
ids
)
marked_todos
=
todos
.
update_all
(
state: :done
)
marked_todos
=
todos
.
update_all
(
state: :done
)
...
...
spec/services/todo_service_spec.rb
View file @
4ad028ae
...
@@ -225,8 +225,8 @@ describe TodoService, services: true do
...
@@ -225,8 +225,8 @@ describe TodoService, services: true do
end
end
end
end
describe
'#mark_todos_as_done_by_id'
do
describe
'#mark_todos_as_done_by_id
s
'
do
it_behaves_like
'marking todos as done'
,
:mark_todos_as_done_by_id
do
it_behaves_like
'marking todos as done'
,
:mark_todos_as_done_by_id
s
do
let
(
:collection
)
{
[
first_todo
,
second_todo
].
map
(
&
:id
)
}
let
(
:collection
)
{
[
first_todo
,
second_todo
].
map
(
&
:id
)
}
end
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