Created
April 15, 2017 00:02
-
-
Save bpaul/103c34ceec2f6107570591d3b1dc53c0 to your computer and use it in GitHub Desktop.
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
def live_release(course_id, do_emails = true, do_push = true) | |
course = Course.find course_id | |
emails_sent = pushes_sent = 0 | |
enrollments = course.enrollments.where(is_complete: false).each do |e| | |
# check the course for new questions and add them to the enrollment | |
e.last_new_introduced = nil | |
e.check_questions | |
# move the questions into todays questions | |
e.last_new_introduced = nil | |
e.todays_questions | |
if do_emails | |
Resque.enqueue(QuestionsLive, e.id, true) | |
emails_sent += 1 | |
end | |
if do_push | |
Resque.enqueue(PushQuestionsLive, e.id, true) | |
pushes_sent += 1 | |
end | |
end | |
puts "#{emails_sent} emails queued and #{pushes_sent} pushes queued for #{course.title}" | |
end | |
should we also specify the enterprise?
@eamonn, I agree. I just replicated the production code. Restricting by enterprise is a good idea but probably not an issue in practice
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Course ID:
13067