Skip to content

Commit 126d8c1

Browse files
committed
Removes tertiary statements I added
1 parent 2d268d8 commit 126d8c1

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

app/controllers/stories_controller.rb

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,16 +103,25 @@ def export
103103

104104
def generate_csv(stories, with_comments: false, export_all: false)
105105
CSV.generate(headers: true) do |csv|
106-
csv << (with_comments ? (CSV_HEADERS + ["comment"]) : CSV_HEADERS)
106+
headers = if with_comments
107+
CSV_HEADERS + ["comment"]
108+
else
109+
CSV_HEADERS
110+
end
111+
112+
csv << headers
107113

108114
stories.by_position.each do |story|
109115
if with_comments
110116
comments = []
111117
story.comments.each do |comment|
112118
comments << "#{display_name(comment.user)}: #{comment.body}"
113119
end
120+
121+
csv << [story.id, story.title, story.description, story.position] + comments
122+
else
123+
csv << story.attributes.slice(*CSV_HEADERS)
114124
end
115-
csv << (with_comments ? ([story.id, story.title, story.description, story.position] + comments) : story.attributes.slice(*CSV_HEADERS))
116125
end
117126
end
118127
end

0 commit comments

Comments
 (0)