-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1917 from alphagov/all_edition_reports
add all edition reports for content workflow and edition churn
- Loading branch information
Showing
8 changed files
with
154 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
class AllContentWorkflowPresenter < CSVPresenter | ||
def initialize(scope = Edition.all) | ||
super(scope) | ||
self.column_headings = %i[ | ||
content_title | ||
content_slug | ||
content_url | ||
current_status | ||
stage | ||
format | ||
current_assignee | ||
created_at | ||
date_created | ||
time_created | ||
] | ||
end | ||
|
||
private | ||
|
||
def build_csv(csv) | ||
csv << column_headings.collect { |ch| ch.to_s.humanize } | ||
scope.each do |item| | ||
item.actions.each do |action| | ||
csv << [ | ||
item.title, | ||
item.slug, | ||
"#{Plek.website_root}/#{item.slug}", | ||
item.state, | ||
action.request_type, | ||
item.format, | ||
item.assignee, | ||
action.created_at.to_fs(:db), | ||
action.created_at.to_date.to_s, | ||
action.created_at.to_fs(:time), | ||
] | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
class AllEditionChurnPresenter < CSVPresenter | ||
def initialize(scope = Edition.all) | ||
super(scope) | ||
self.column_headings = %i[ | ||
id | ||
panopticon_id | ||
name | ||
slug | ||
state | ||
editioned_on | ||
version_number | ||
date_created | ||
time_created | ||
] | ||
end | ||
|
||
private | ||
|
||
def get_value(header, edition) | ||
case header | ||
when :name | ||
edition.title | ||
when :editioned_on | ||
edition.created_at.iso8601 | ||
when :date_created | ||
edition.created_at.to_date.to_s | ||
when :time_created | ||
edition.created_at.to_fs(:time) | ||
else | ||
super | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters