Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions app/presenters/content_items_csv_presenter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ def csv_rows
end,
I18n.t("metrics.words.short_title") => raw_field(:word_count),
I18n.t("metrics.pdf_count.short_title") => raw_field(:pdf_count),
I18n.t("metrics.email_subscriptions.active_title") => raw_field(:subscriber_list_count),
I18n.t("metrics.email_subscriptions.total_notify_title") => raw_field(:all_notify_count),
}

CSV.generate do |csv|
Expand Down
14 changes: 14 additions & 0 deletions spec/presenters/content_items_csv_presenter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
word_count: 50,
reading_time: 50,
pdf_count: 0,
subscriber_list_count: 10,
all_notify_count: 300,
},
{
title: "Title 1",
Expand All @@ -53,6 +55,8 @@
word_count: 100,
reading_time: 100,
pdf_count: 3,
subscriber_list_count: 0,
all_notify_count: 123,
},
]
end
Expand Down Expand Up @@ -92,6 +96,8 @@
I18n.t("metrics.reading_time.short_title"),
I18n.t("metrics.words.short_title"),
I18n.t("metrics.pdf_count.short_title"),
I18n.t("metrics.email_subscriptions.active_title"),
I18n.t("metrics.email_subscriptions.total_notify_title"),
]

expected_headers.each do |header_name|
Expand Down Expand Up @@ -177,6 +183,14 @@
it "has pdf count" do
expect(subject[17]).to eq("0")
end

it "has email subscriber list count" do
expect(subject[18]).to eq("10")
end

it "has email all notify count" do
expect(subject[19]).to eq("300")
end
end
end

Expand Down
Loading