Commit 279cebd5 by Bridger Maxwell

Added random shuffling of survey questions.

parent 91d04c67
exit_survey_questions = {
'common_questions' : [
{'type' : 'survey_checkbox',
'question_name' : 'survey_future_classes',
'label' : 'Please inform me of future classes offered by edX.'},
{'type' : 'survey_checkbox',
'question_name' : 'survey_future_offerings',
'label' : 'Please inform me of opportunities to help with future offerings of 6.002x, such as staffing discussiong forums or developing content.'},
{'type' : 'survey_checkbox',
'question_name' : 'survey_6002x_updates',
'label' : 'Please subscribe me to periodic updates about additional topics, refreshers, and follow-ups for topics in 6.002x.'},
],
'random_questions' : [
{'type' : 'survey_radio',
'question_name' : 'survey_teach_ee',
'label' : 'Do you teach electrical engineering (EE)?',
'choices' : [
'I teach EE in college/university.',
'I teach EE in high school/secondary school.',
'I do not teach EE.',
]},
{'type' : 'survey_radio',
'question_name' : 'survey_highest_degree',
'label' : 'What is the highest degree you have completed?',
'choices' : [
'I have a PhD in a science or engineering field.',
'I have a PhD in another field.',
'I have a masters or professional degree.',
'I have a bachelors degree.',
'I completed secondary/high school.',
'I completed junior secondary/high school.',
'I completed elementary school.',
]},
{'type' : 'survey_short_field',
'question_name' : 'survey_age',
'label' : 'What is your age?',
},
{'type' : 'survey_short_field',
'question_name' : 'survey_gender',
'label' : 'What is your gender?',
},
{'type' : 'survey_radio',
'question_name' : 'survey_scholarship_secondary',
'label' : 'Did you receive any scholarship or financial assistance to attend secondary school?',
'choices' : [
'Yes',
'No',
]},
{'type' : 'survey_radio',
'question_name' : 'survey_scholarship_college',
'label' : 'Did you receive any scholarship or financial assistanche to attend college/university?',
'choices' : [
'Yes',
'No',
]},
{'type' : 'survey_radio',
'question_name' : 'survey_ee_level',
'label' : 'What is the highest level electrical engineering (EE) course you have taken? ',
'choices' : [
' more than one year of EE in college/university',
' one year or less of EE in college/university',
' more than one year of EE in high school/secondary school',
' one year or less of EE in high school/secondary school',
' self-taught in EE',
' none of the above',
]},
{'type' : 'survey_radio',
'question_name' : 'survey_math_level',
'label' : 'What is the highest level mathematics course you have taken?',
'choices' : [
' mathematics beyond calculus of a single variable in college/university',
' single variable calculus',
' algebra',
' self-taught in mathematics',
' none of the above',
]},
{'type' : 'survey_check',
'question_name' : 'survey_why_course',
'label' : 'Why are you taking this course? (Check all that apply.)',
'choices' : [
'Interest in topic only',
'Preparation for advanced placement exam',
'Preparation for advanced standing exam',
'Review of EE concepts',
'Employment/job advancement opportunities',
'Other',
]},
{'type' : 'survey_radio',
'question_name' : 'survey_weekly_hours',
'label' : 'How many hours a week on average did you work on this course? ',
'choices' : [
'0-2',
'3-5',
'6-9',
'10 or more',
]},
{'type' : 'survey_radio',
'question_name' : 'survey_internet_access',
'label' : 'Where do you access the MITx website most frequently?',
'choices' : [
'At home',
'At the home of a friend or family member outside your home',
'At school',
'Internet cafe or other public space',
'Other',
]},
{'type' : 'survey_radio',
'question_name' : 'survey_work_offline',
'label' : 'Have you worked offline with anyone on the MITx material?',
'choices' : [
'I worked with another person who is also completing the course.',
'I worked with someone who teaches or has expertise in this area.',
'I worked completely on my own.',
'Other',
]},
{'type' : 'survey_radio',
'question_name' : 'survey_online_course_count',
'label' : 'How many online courses have you taken?',
'choices' : [
'1',
'2',
'3',
'4',
'5 or more',
]},
{'type' : 'survey_short_field',
'question_name' : 'survey_home_language',
'label' : 'Language most spoken in your home:',
},
{'type' : 'survey_short_field',
'question_name' : 'survey_home_postal_code',
'label' : 'Postal code (home address):',
},
{'type' : 'survey_short_field',
'question_name' : 'survey_home_country',
'label' : 'Country (home address):',
},
{'type' : 'survey_short_field',
'question_name' : 'survey_race',
'label' : 'With what race/ethnic group do you most strongly identify?',
},
{'type' : 'survey_radio',
'question_name' : 'survey_online_course_count',
'label' : 'How many books are there in your home? (There are usually about 40 books per meter of shelving. Do not include magazines, newspapers, or schoolbooks in your estimate.)',
'choices' : [
'0-10 books',
'11-25 books',
'26-100 books',
'101-200 books',
'201-500 books',
'More than 500 books',
]},
{'type' : 'survey_radio',
'question_name' : 'survey_computer_in_home',
'label' : 'Did you have a computer in your home?',
'choices' : [
'Yes',
'No',
]},
{'type' : 'survey_radio',
'question_name' : 'survey_parents_engineering',
'label' : 'Do either of your parents have any training or experience in engineering?',
'choices' : [
'Yes',
'No',
'I don\'t know',
]},
{'type' : 'survey_radio',
'question_name' : 'survey__engineering',
'label' : 'What is the highest level of schooling completed by one of your parents? (Please choose the answer you think fits best.)',
'choices' : [
'PhD degree',
'Post-graduate, professional degree, or master\'s degree',
'Bachelor\'s degree',
'Vocational/technical training',
'High school or secondary school',
'Primary school',
'Did not complete primary school',
]},
]
}
\ No newline at end of file
...@@ -27,6 +27,9 @@ from models import StudentModule ...@@ -27,6 +27,9 @@ from models import StudentModule
from student.models import UserProfile from student.models import UserProfile
from student.views import student_took_survey from student.views import student_took_survey
if settings.END_COURSE_ENABLED:
from courseware.survey_questions import exit_survey_questions
import courseware.content_parser as content_parser import courseware.content_parser as content_parser
import courseware.modules.capa_module import courseware.modules.capa_module
...@@ -89,6 +92,18 @@ def profile(request, student_id = None): ...@@ -89,6 +92,18 @@ def profile(request, student_id = None):
if settings.END_COURSE_ENABLED: if settings.END_COURSE_ENABLED:
took_survey = student_took_survey(user_info) took_survey = student_took_survey(user_info)
survey_list = []
if not took_survey:
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
chosen_indices = random.sample( range( len(randomized_questions) ), 15 )
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
...@@ -108,7 +123,8 @@ def profile(request, student_id = None): ...@@ -108,7 +123,8 @@ def profile(request, student_id = None):
context.update({'certificate_requested' : certificate_requested, context.update({'certificate_requested' : certificate_requested,
'certificate_download_url' : certificate_download_url, 'certificate_download_url' : certificate_download_url,
'took_survey' : took_survey}) 'took_survey' : took_survey,
'survey_list' : survey_list})
return render_to_response('profile.html', context) return render_to_response('profile.html', context)
......
<%inherit file="main.html" /> <%inherit file="main.html" />
<%namespace name="profile_graphs" file="profile_graphs.js"/> <%namespace name="profile_graphs" file="profile_graphs.js"/>
<%namespace name="survey_questions" file="survey_questions.html"/>
<%block name="title"><title>Profile - MITx 6.002x</title></%block> <%block name="title"><title>Profile - MITx 6.002x</title></%block>
...@@ -170,7 +171,9 @@ $(function() { ...@@ -170,7 +171,9 @@ $(function() {
$("#survey_form").submit(function(){ $("#survey_form").submit(function(){
var values = {'survey_future_classes' : $("#survey_future_classes").is(':checked'), var values = {'survey_future_classes' : $("#survey_future_classes").is(':checked'),
'survey_future_offerings' : $("#survey_future_offerings").is(':checked'), 'survey_future_offerings' : $("#survey_future_offerings").is(':checked'),
'survey_6002x_updates' : $("#survey_6002x_updates").is(':checked'), }; 'survey_6002x_updates' : $("#survey_6002x_updates").is(':checked'),
'survey_teach_ee' : $('input:radio[name=survey_teach_ee]:checked').val(),
};
postJSON('/record_exit_survey', values, function(data) { postJSON('/record_exit_survey', values, function(data) {
if (true || data.success) { if (true || data.success) {
...@@ -445,20 +448,9 @@ $(function() { ...@@ -445,20 +448,9 @@ $(function() {
<h1>Please take this short survey about 6.002x.</h1> <h1>Please take this short survey about 6.002x.</h1>
<div id="survey_error"> </div> <div id="survey_error"> </div>
<ul>
<li class="survey_checkbox"> ${survey_questions.body(survey_list)}
<input type="checkbox" id="survey_future_classes"/>
<label> Please inform me of future classes offered by edX.</label>
</li>
<li class="survey_checkbox">
<input type="checkbox" id="survey_future_offerings"/>
<label> Please inform me of opportunities to help with future offerings of 6.002x, such as staffing discussiong forums or developing content. </label>
</li>
<li class="survey_checkbox">
<input type="checkbox" id="survey_6002x_updates"/>
<label> Please subscribe me to periodic updates about additional topics, refreshers, and follow-ups for topics in 6.002x. </label>
</li>
</ul>
</fieldset> </fieldset>
</div> </div>
......
<%page args="survey_list, **kwargs"/>
<%def name="survey_radio(question_name, label, choices)">
<li class="survey_radio">
<label>${label}</label><br/>
%for choice in choices:
<input type="radio" name="${question_name}" value="${choice}"/>${choice}<br>
%endfor
</li>
</%def>
<%def name="survey_checkbox(question_name, label)">
<li class="survey_checkbox">
<input type="checkbox" id="${question_name}"/>
<label>${label}</label>
</li>
</%def>
<%def name="survey_short_field(question_name, label)">
<li class="survey_short_field">
<label>${label}</label>
<input type="text" name="${question_name}"/>
</li>
</%def>
<ul>
%for survey_question in survey_list:
%if survey_question['type'] == 'survey_radio':
${survey_radio(survey_question['question_name'], survey_question['label'], survey_question['choices']) }
%elif survey_question['type'] == 'survey_checkbox':
${survey_checkbox(survey_question['question_name'], survey_question['label']) }
%elif survey_question['type'] == 'survey_short_field':
${survey_short_field(survey_question['question_name'], survey_question['label']) }
%endif
%endfor
</ul>
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