Simplify helper (and remove alteration of string literal)

This commit is contained in:
James Mason 2018-05-07 17:24:49 -07:00
parent 6d31dfeef4
commit 8a422412d6

View file

@ -62,17 +62,7 @@ module ApplicationHelper
end end
def difficulty_levels(conference) def difficulty_levels(conference)
all = conference.program.difficulty_levels.map {|t| t.title} conference.program.difficulty_levels.map(&:title).to_sentence
first = all[0...-1]
last = all[-1]
ts = ''
if all.length > 1
ts << first.join(', ')
ts << " and #{last}"
else
ts = all.join
end
ts
end end
def unread_notifications(user) def unread_notifications(user)