Skip to content

Commit

Permalink
Add project to issue render helper
Browse files Browse the repository at this point in the history
  • Loading branch information
CuddlyBunion341 committed Jan 14, 2025
1 parent 552ece5 commit 7836cab
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
5 changes: 4 additions & 1 deletion app/helpers/timer_sessions_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,12 @@ def sum_work_hours(timer_sessions)
def issue_information(issue)
subject = issue.subject
issue_information = issue.id.to_s

truncated_subject = subject[0..(MAX_SUBJECT_LENGTH - issue.project.name.length - issue_information.length)]

[
issue_information,
"#{subject[0..(MAX_SUBJECT_LENGTH - issue_information.length)]}#{subject_label_trail(subject)}"
"[#{issue.project.name}] #{truncated_subject}#{subject_label_trail(subject)}"
].join(': ')
end

Expand Down
1 change: 1 addition & 0 deletions test/functional/timer_sessions_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ def setup
get(:index)
assert_response 200
assert response.body.include?(@issue.subject)
assert response.body.include?(@issue.project.name)
assert response.body.include?(@timer_session.splittable_hours.round(2).to_s)
end

Expand Down
2 changes: 1 addition & 1 deletion test/unit/timer_sessions_helper_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,6 @@ class TimerSessionsHelperTest < ActionView::TestCase
end

test '#issue_link_list' do
assert_equal ['<a href="/issues/1">1: Cannot print recipes</a>'], issue_link_list([Issue.first])
assert_equal ['<a href="/issues/1">1: [eCookbook] Cannot print recipes</a>'], issue_link_list([Issue.first])
end
end

0 comments on commit 7836cab

Please sign in to comment.