Commit 6b7ff213 by Bridger Maxwell

Moved the survey_questions file to student module.

parent e637d69f
...@@ -28,7 +28,7 @@ from student.models import UserProfile ...@@ -28,7 +28,7 @@ from student.models import UserProfile
from student.views import student_took_survey from student.views import student_took_survey
if settings.END_COURSE_ENABLED: if settings.END_COURSE_ENABLED:
from courseware.survey_questions import exit_survey_questions from student.survey_questions import exit_survey_list_for_student
import courseware.content_parser as content_parser import courseware.content_parser as content_parser
import courseware.modules.capa_module import courseware.modules.capa_module
...@@ -96,19 +96,7 @@ def profile(request, student_id = None): ...@@ -96,19 +96,7 @@ def profile(request, student_id = None):
took_survey = False took_survey = False
survey_list = [] survey_list = []
if not took_survey: if not took_survey:
common_questions = exit_survey_questions['common_questions'] survey_list = exit_survey_list_for_student(student)
randomized_questions = exit_survey_questions['random_questions']
#If we use random.sample on randomized_questions directly, it will re-arrange the questions
if not settings.DEBUG_SURVEY:
chosen_indices = random.sample( range( len(randomized_questions) ), 6 )
else:
#In debug mode, we show all surveys
chosen_indices = range( len(randomized_questions) )
chosen_questions = [ randomized_questions[i] for i in sorted(chosen_indices)]
survey_list = common_questions + chosen_questions
# certificate_requested determines if the student has requested a certificate # certificate_requested determines if the student has requested a certificate
certificate_requested = False certificate_requested = False
......
import settings
def exit_survey_list_for_student(student):
# Right now, we just randomly pick some questions from random_questions
common_questions = exit_survey_questions['common_questions']
randomized_questions = exit_survey_questions['random_questions']
#If we use random.sample on randomized_questions directly, it will re-arrange the questions
if not settings.DEBUG_SURVEY:
chosen_indices = random.sample( range( len(randomized_questions) ), 6 )
else:
#In debug mode, we show all surveys
chosen_indices = range( len(randomized_questions) )
chosen_questions = [ randomized_questions[i] for i in sorted(chosen_indices)]
survey_list = common_questions + chosen_questions
return survey_list
exit_survey_questions = { exit_survey_questions = {
'common_questions' : [ 'common_questions' : [
{'type' : 'checkbox', {'type' : 'checkbox',
......
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