Skip to content

Commit 608b967

Browse files
committed
Fix rubocop errors
1 parent 8d0f471 commit 608b967

2 files changed

Lines changed: 19 additions & 16 deletions

File tree

modules/backlogs/app/controllers/backlogs/work_packages_controller.rb

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -36,24 +36,12 @@ class WorkPackagesController < BaseController
3636

3737
# Deferred ActionMenu items (Primer include-fragment).
3838
def menu
39-
max_position = displayed_work_packages.maximum(:position) || 0
40-
41-
open_sprints_exist = Sprint.for_project(@project)
42-
.visible
43-
.not_completed
44-
.where.not(id: @work_package.sprint_id)
45-
.exists?
46-
47-
other_buckets_exist = BacklogBucket.where(project: @project)
48-
.where.not(id: @work_package.backlog_bucket_id)
49-
.exists?
50-
5139
render(Backlogs::WorkPackageCardMenuComponent.new(
5240
work_package: @work_package,
5341
project: @project,
5442
max_position:,
55-
open_sprints_exist:,
56-
other_buckets_exist:,
43+
open_sprints_exist: open_sprints_exist?,
44+
other_buckets_exist: other_buckets_exist?,
5745
current_user:
5846
),
5947
layout: false)
@@ -142,5 +130,20 @@ def displayed_work_packages
142130
@work_packages.merge(WorkPackage.backlogs_inbox_for(project: @project))
143131
end
144132
end
133+
134+
def max_position = displayed_work_packages.maximum(:position) || 0
135+
136+
def open_sprints_exist?
137+
Sprint.for_project(@project).visible
138+
.not_completed
139+
.where.not(id: @work_package.sprint_id)
140+
.exists?
141+
end
142+
143+
def other_buckets_exist?
144+
BacklogBucket.where(project: @project)
145+
.where.not(id: @work_package.backlog_bucket_id)
146+
.exists?
147+
end
145148
end
146149
end

modules/backlogs/spec/controllers/backlogs/work_packages_controller_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -875,8 +875,8 @@
875875

876876
context "when the work package is in a bucket" do
877877
let(:current_bucket) { create(:backlog_bucket, project:) }
878-
let(:other_project_bucket_wp) { create(:work_package, status:, project:, backlog_bucket: current_bucket) }
879-
let(:params) { { project_id: project.id, id: other_project_bucket_wp.id } }
878+
let(:current_bucket_wp) { create(:work_package, status:, project:, backlog_bucket: current_bucket) }
879+
let(:params) { { project_id: project.id, id: current_bucket_wp.id } }
880880

881881
it "responds with a dialog turbo stream" do
882882
subject

0 commit comments

Comments
 (0)