Skip to content

Commit

Permalink
Review
Browse files Browse the repository at this point in the history
  • Loading branch information
CuddlyBunion341 committed Jan 14, 2025
1 parent 7836cab commit b584c3f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
15 changes: 10 additions & 5 deletions app/helpers/timer_sessions_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,21 @@ 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,
"[#{issue.project.name}] #{truncated_subject}#{subject_label_trail(subject)}"
issue_identifier(issue),
"#{truncated_subject(subject)}#{subject_label_trail(subject)}"
].join(': ')
end

def issue_identifier(issue)
"[#{issue.project.name}] #{issue.id}"
end

def truncated_subject(subject)
subject[0..(MAX_SUBJECT_LENGTH - subject.length)]
end

def subject_label_trail(subject)
'...' if subject.length > MAX_SUBJECT_LENGTH
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: [eCookbook] Cannot print recipes</a>'], issue_link_list([Issue.first])
assert_equal ['<a href="/issues/1">[eCookbook] 1: Cannot print recipes</a>'], issue_link_list([Issue.first])
end
end

0 comments on commit b584c3f

Please sign in to comment.