Skip to content

Commit

Permalink
Add script for getting pages that ended up in draft space
Browse files Browse the repository at this point in the history
  • Loading branch information
ragesoss committed Jan 6, 2024
1 parent 70b491d commit bdb0a29
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion docs/analytics_scripts/draft_space_per_term.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Get stats on how much per term has ended up in draft space

stats = {}
Campaign.all.each do |campaign|
puts campaign.slug
Expand All @@ -8,4 +10,22 @@
stats[campaign.slug] = { draft:, mainspace:, ratio: }
end

puts stats
puts stats

# Get the titles of all the edited articles for a term that ended up in Draft space

term = Campaign.find_by_slug 'fall_2023'
drafts = []

term.courses.each do |course|
pp course.slug
article_ids = course.revisions.pluck(:article_id).uniq
drafts << Article.where(id: article_ids, namespace: 118).pluck(:title)
end

drafts.flatten!
puts drafts.count

File.open("/home/sage/drafts_2023.txt", "w+") do |f|
f.puts(drafts)
end

0 comments on commit bdb0a29

Please sign in to comment.