Skip to content

Commit b94a116

Browse files
myabcclaude
andcommitted
Add Sprint#board_name
Use `Sprint#board_name` in `RbTaskboardsController` instead of building the board name inline. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 12fbc90 commit b94a116

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

modules/backlogs/app/controllers/rb_taskboards_controller.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,7 @@ def show
4040
private
4141

4242
def load_or_create_board
43-
name = "#{@project.name}: #{@sprint.name}"
44-
result = TaskBoards::CreateService.ensure(user: current_user, project: @project, name:)
43+
result = TaskBoards::CreateService.ensure(user: current_user, project: @project, name: @sprint.board_name)
4544

4645
if result.success?
4746
@board = result.result

modules/backlogs/app/models/sprint.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,10 @@ def settings(project)
160160
version_settings.find { it.project_id == project.id || it.project_id.nil? }
161161
end
162162

163+
def board_name
164+
"#{project.name}: #{name}"
165+
end
166+
163167
private
164168

165169
def create_wiki_page(page_title, author: User.current)

modules/backlogs/spec/models/sprint_spec.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,13 @@
261261
end
262262
end
263263

264+
describe "#board_name" do
265+
it "returns project name and sprint name separated by a colon" do
266+
sprint = build_stubbed(:sprint, name: "Sprint 1", project: build_stubbed(:project, name: "My Project"))
267+
expect(sprint.board_name).to eq("My Project: Sprint 1")
268+
end
269+
end
270+
264271
describe "#wiki_page" do
265272
let(:wiki) { create :wiki, project: }
266273
let(:wiki_page) { WikiPage.where(wiki:, title: sprint.wiki_page).first }

0 commit comments

Comments
 (0)