Commit 4f6baa59 by Kevin Chugh

fix rake

parent ad3aa917
...@@ -124,32 +124,32 @@ namespace :kpis do ...@@ -124,32 +124,32 @@ namespace :kpis do
puts "Average Engagement Per Engaging User: #{ratio}\n\n\n " puts "Average Engagement Per Engaging User: #{ratio}\n\n\n "
end end
end
task :orphans => :environment do
#USAGE
#SINATRA_ENV=development rake kpis:oprhans
#or
#SINATRA_ENV=development bundle exec rake kpis:orphans
courses = Content.all.distinct("course_id")
puts "\n\n****************************************************"
puts "thread reply rate per course on edX (#{Date.today}) "
puts "********************************************************\n\n"
task :orphans => :environment do courses.each do |c|
#USAGE #first, get all the users who have contributed
#SINATRA_ENV=development rake kpis:oprhans threads = Content.where({"course_id" => c, "_type" => "CommentThread"})
#or orphans = Content.where({"course_id" => c, "_type" => "CommentThread", "comment_count" => 0})
#SINATRA_ENV=development bundle exec rake kpis:orphans
ratio = oprhans.count.to_f / threads.to_f
courses = Content.all.distinct("course_id")
puts "\n\n****************************************************" puts c
puts "thread reply rate per course on edX (#{Date.today}) " puts "*********************"
puts "********************************************************\n\n" puts "Total Threads: #{threads.count}"
puts "Total Orphaned Threads: #{orphans.count}"
courses.each do |c| if threads.count > 0
#first, get all the users who have contributed puts "Orphan Ratio: #{ratio}"
threads = Content.where({"course_id" => c, "_type" => "CommentThread"})
orphans = Content.where({"course_id" => c, "_type" => "CommentThread", "comment_count" => 0})
ratio = oprhans.count.to_f / threads.to_f
puts c
puts "*********************"
puts "Total Threads: #{threads.count}"
puts "Total Orphaned Threads: #{orphans.count}"
if threads.count > 0
puts "Orphan Ratio: #{ratio}"
end
end end
end end
end end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment