Skip to content

Commit

Permalink
Merge pull request #1998 from alphagov/fix-rake-task
Browse files Browse the repository at this point in the history
Improve rake task
  • Loading branch information
KludgeKML authored Sep 12, 2023
2 parents 867c6f2 + 7e8f6ba commit 29e41cb
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/reports/concerns/notification_stats.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module Reports::Concerns::NotificationStats
def list_names_array(lists)
lists.collect(&:title)
lists.map { |l| "#{l.title} (#{l.subscriptions.active.count} active subscribers)" }
end

def list_stats_array(lists)
Expand Down
5 changes: 4 additions & 1 deletion lib/reports/future_content_change_statistics_report.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def supertypes(content_item)
end

def tags_from_content_item(content_item)
content_item["details"]["tags"].merge(additional_items(content_item))
content_item["details"].fetch("tags", {}).merge(additional_items(content_item))
end

def links_from_content_item(content_item)
Expand All @@ -80,6 +80,9 @@ def additional_items(content_item)
end

def taxon_tree(content_item)
return [] unless content_item["links"].key?("taxons")
return [] unless content_item["links"]["taxons"].any?

[content_item["links"]["taxons"].first["content_id"]] + get_parent_links(content_item["links"]["taxons"].first)
end

Expand Down
2 changes: 1 addition & 1 deletion lib/tasks/report.rake
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ namespace :report do
task :future_content_change_statistics, %i[govuk_path draft] => :environment do |_t, args|
puts Reports::FutureContentChangeStatisticsReport.new(
args.fetch(:govuk_path),
args.fetch(:draft).downcase == "true",
args.fetch(:draft, "false").downcase == "true",
).call
end
end

0 comments on commit 29e41cb

Please sign in to comment.