Skip to content

Instantly share code, notes, and snippets.

@vparihar01
Created June 28, 2014 11:36
Show Gist options
  • Save vparihar01/a0225a83fce95c3af59d to your computer and use it in GitHub Desktop.
Save vparihar01/a0225a83fce95c3af59d to your computer and use it in GitHub Desktop.
Learn
def my_logger
@@mdefy_logger ||= Logger.new("#{Rails.root}/log/quiz.log")
end
c = LegacyCourses.find(11111)
c.legacy_course_units.each_with_index do |i,index|
num = index
#my_logger.info "Chapter #{i.title}"
i.legacy_course_sections.all.each_with_index do |j,index|
#my_logger.info "Chapter Number => #{num} Title #{i.title}"
#my_logger.info "Section Number => #{index} Title #{j.title}"
j.legacy_course_pages.each do |k|
if k.linkedQuizID.present?
my_logger.info " -------------- -------------- -------------- -------------- "
my_logger.info "Chapter Number => #{num} Title #{i.title}"
my_logger.info "Section Number => #{index} Title #{j.title}"
my_logger.info "SubSection => #{k.title}"
a = LegacyQuizzes.find(k.linkedQuizID)
my_logger.info "Quiz Title => #{a.title}"
a.legacy_quiz_questions.each do |l|
my_logger.info " ===========QUESTION START=============="
my_logger.info "Question title => #{l.questText}"
l.legacy_quiz_answers.each_with_index do |m,index|
my_logger.info " ...........ANSWER START..........."
my_logger.info "No.#{index} ANSWER TEXT => #{ActionView::Base.full_sanitizer.sanitize(m.answerText)}"
my_logger.info "ANSWER correct => #{m.correct}"
my_logger.info "...........ANSWER END..........."
end
my_logger.info " ===========QUESTION END==========="
end
my_logger.info " -------------- -------------- -------------- -------------- "
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment