Commit e637d69f by Bridger Maxwell

Survey now supports (Check all that apply) questions. Fixed some typos in survey.

parent 49162760
exit_survey_questions = { exit_survey_questions = {
'common_questions' : [ 'common_questions' : [
{'type' : 'survey_checkbox', {'type' : 'checkbox',
'question_name' : 'survey_future_classes', 'question_name' : 'future_classes',
'label' : 'Please inform me of future classes offered by edX.'}, 'label' : 'Please inform me of future classes offered by edX.'},
{'type' : 'survey_checkbox', {'type' : 'checkbox',
'question_name' : 'survey_future_offerings', 'question_name' : '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' : 'Please inform me of opportunities to help with future offerings of 6.002x, such as staffing discussiong forums or developing content.'},
{'type' : 'survey_checkbox', #I think we should combine this question with the one above it. Mostly to shorten the survey
'question_name' : 'survey_6002x_updates', {'type' : 'checkbox',
'question_name' : '6002x_updates',
'label' : 'Please subscribe me to periodic updates about additional topics, refreshers, and follow-ups for topics in 6.002x.'}, 'label' : 'Please subscribe me to periodic updates about additional topics, refreshers, and follow-ups for topics in 6.002x.'},
], ],
'random_questions' : [ 'random_questions' : [
{'type' : 'survey_radio', {'type' : 'radio',
'question_name' : 'survey_teach_ee', 'question_name' : 'teach_ee',
'label' : 'Do you teach electrical engineering (EE)?', 'label' : 'Do you teach electrical engineering (EE)?',
'choices' : [ 'choices' : [
'I teach EE in college/university.', 'I teach EE in college/university.',
...@@ -22,70 +23,71 @@ exit_survey_questions = { ...@@ -22,70 +23,71 @@ exit_survey_questions = {
'I do not teach EE.', 'I do not teach EE.',
]}, ]},
{'type' : 'survey_radio', {'type' : 'radio',
'question_name' : 'survey_highest_degree', 'question_name' : 'highest_degree',
'label' : 'What is the highest degree you have completed?', 'label' : 'What is the highest degree you have completed?',
'choices' : [ 'choices' : [
'I have a PhD in a science or engineering field.', 'I have a PhD in a science or engineering field.',
'I have a PhD in another field.', 'I have a PhD in another field.',
'I have a masters or professional degree.', 'I have a master\'s or professional degree.',
'I have a bachelors degree.', 'I have a bachelor\'s degree.',
'I completed secondary/high school.', 'I completed secondary/high school.',
'I completed junior secondary/high school.', 'I completed junior secondary/high school.',
'I completed elementary school.', 'I completed elementary school.',
]}, ]},
{'type' : 'survey_short_field', {'type' : 'short_field',
'question_name' : 'survey_age', 'question_name' : 'age',
'label' : 'What is your age?', 'label' : 'What is your age?',
}, },
{'type' : 'survey_short_field', # We could also do this as a radio Male/Female/Other
'question_name' : 'survey_gender', {'type' : 'short_field',
'question_name' : 'gender',
'label' : 'What is your gender?', 'label' : 'What is your gender?',
}, },
{'type' : 'survey_radio', {'type' : 'radio',
'question_name' : 'survey_scholarship_secondary', 'question_name' : 'scholarship_secondary',
'label' : 'Did you receive any scholarship or financial assistance to attend secondary school?', 'label' : 'Did you receive any scholarship or financial assistance to attend <b>secondary school</b>?',
'choices' : [ 'choices' : [
'Yes', 'Yes',
'No', 'No',
]}, ]},
{'type' : 'survey_radio', {'type' : 'radio',
'question_name' : 'survey_scholarship_college', 'question_name' : 'scholarship_college',
'label' : 'Did you receive any scholarship or financial assistanche to attend college/university?', 'label' : 'Did you receive any scholarship or financial assistanche to attend <b>college/university</b>?',
'choices' : [ 'choices' : [
'Yes', 'Yes',
'No', 'No',
]}, ]},
{'type' : 'survey_radio', {'type' : 'radio',
'question_name' : 'survey_ee_level', 'question_name' : 'ee_level',
'label' : 'What is the highest level electrical engineering (EE) course you have taken? ', 'label' : 'What is the highest level electrical engineering (EE) course you have taken? ',
'choices' : [ 'choices' : [
' more than one year of EE in college/university', 'More than one year of EE in college/university',
' one year or less 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', 'More than one year of EE in high school/secondary school',
' one year or less of EE in high school/secondary school', 'One year or less of EE in high school/secondary school',
' self-taught in EE', 'Self-taught in EE',
' none of the above', 'None of the above',
]}, ]},
{'type' : 'survey_radio', {'type' : 'radio',
'question_name' : 'survey_math_level', 'question_name' : 'math_level',
'label' : 'What is the highest level mathematics course you have taken?', 'label' : 'What is the highest level mathematics course you have taken?',
'choices' : [ 'choices' : [
' mathematics beyond calculus of a single variable in college/university', 'Mathematics beyond calculus of a single variable in college/university',
' single variable calculus', 'Single variable calculus',
' algebra', 'Algebra',
' self-taught in mathematics', 'Self-taught in mathematics',
' none of the above', 'None of the above',
]}, ]},
{'type' : 'survey_check', {'type' : 'select_many',
'question_name' : 'survey_why_course', 'question_name' : 'why_course',
'label' : 'Why are you taking this course? (Check all that apply.)', 'label' : 'Why are you taking this course? (Check all that apply.)',
'choices' : [ 'choices' : [
'Interest in topic only', 'Interest in topic only',
...@@ -96,9 +98,9 @@ exit_survey_questions = { ...@@ -96,9 +98,9 @@ exit_survey_questions = {
'Other', 'Other',
]}, ]},
{'type' : 'survey_radio', {'type' : 'radio',
'question_name' : 'survey_weekly_hours', 'question_name' : 'weekly_hours',
'label' : 'How many hours a week on average did you work on this course? ', 'label' : 'How many hours per week on average did you work on this course?',
'choices' : [ 'choices' : [
'0-2', '0-2',
'3-5', '3-5',
...@@ -106,8 +108,8 @@ exit_survey_questions = { ...@@ -106,8 +108,8 @@ exit_survey_questions = {
'10 or more', '10 or more',
]}, ]},
{'type' : 'survey_radio', {'type' : 'radio',
'question_name' : 'survey_internet_access', 'question_name' : 'internet_access',
'label' : 'Where do you access the MITx website most frequently?', 'label' : 'Where do you access the MITx website most frequently?',
'choices' : [ 'choices' : [
'At home', 'At home',
...@@ -117,9 +119,9 @@ exit_survey_questions = { ...@@ -117,9 +119,9 @@ exit_survey_questions = {
'Other', 'Other',
]}, ]},
{'type' : 'survey_radio', {'type' : 'radio',
'question_name' : 'survey_work_offline', 'question_name' : 'work_offline',
'label' : 'Have you worked offline with anyone on the MITx material?', 'label' : 'Have you worked <b>offline</b> with anyone on the MITx material?',
'choices' : [ 'choices' : [
'I worked with another person who is also completing the course.', '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 with someone who teaches or has expertise in this area.',
...@@ -127,8 +129,8 @@ exit_survey_questions = { ...@@ -127,8 +129,8 @@ exit_survey_questions = {
'Other', 'Other',
]}, ]},
{'type' : 'survey_radio', {'type' : 'radio',
'question_name' : 'survey_online_course_count', 'question_name' : 'online_course_count',
'label' : 'How many online courses have you taken?', 'label' : 'How many online courses have you taken?',
'choices' : [ 'choices' : [
'1', '1',
...@@ -138,29 +140,31 @@ exit_survey_questions = { ...@@ -138,29 +140,31 @@ exit_survey_questions = {
'5 or more', '5 or more',
]}, ]},
{'type' : 'survey_short_field', {'type' : 'short_field',
'question_name' : 'survey_home_language', 'question_name' : 'home_language',
'label' : 'Language most spoken in your home:', 'label' : 'Language most spoken in your home:',
}, },
{'type' : 'survey_short_field', {'type' : 'short_field',
'question_name' : 'survey_home_postal_code', 'question_name' : 'home_postal_code',
'label' : 'Postal code (home address):', 'label' : 'Postal code (home address):',
}, },
{'type' : 'survey_short_field', # This question seems redundant with the above question. Remove it? Does the whole world have postal codes?
'question_name' : 'survey_home_country', # Also, we already asked for a location
{'type' : 'short_field',
'question_name' : 'home_country',
'label' : 'Country (home address):', 'label' : 'Country (home address):',
}, },
{'type' : 'survey_short_field', {'type' : 'short_field',
'question_name' : 'survey_race', 'question_name' : 'race',
'label' : 'With what race/ethnic group do you most strongly identify?', 'label' : 'With what race/ethnic group do you most strongly identify?',
}, },
{'type' : 'survey_radio', {'type' : 'radio',
'question_name' : 'survey_online_course_count', 'question_name' : 'book_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.)', 'label' : 'How many books are there in your home? <br/><i>(There are usually about 40 books per meter of shelving. Do not include magazines, newspapers, or schoolbooks in your estimate.)</i>',
'choices' : [ 'choices' : [
'0-10 books', '0-10 books',
'11-25 books', '11-25 books',
...@@ -170,16 +174,16 @@ exit_survey_questions = { ...@@ -170,16 +174,16 @@ exit_survey_questions = {
'More than 500 books', 'More than 500 books',
]}, ]},
{'type' : 'survey_radio', {'type' : 'radio',
'question_name' : 'survey_computer_in_home', 'question_name' : 'computer_in_home',
'label' : 'Did you have a computer in your home?', 'label' : 'Did you have a computer in your home?',
'choices' : [ 'choices' : [
'Yes', 'Yes',
'No', 'No',
]}, ]},
{'type' : 'survey_radio', {'type' : 'radio',
'question_name' : 'survey_parents_engineering', 'question_name' : 'parents_engineering',
'label' : 'Do either of your parents have any training or experience in engineering?', 'label' : 'Do either of your parents have any training or experience in engineering?',
'choices' : [ 'choices' : [
'Yes', 'Yes',
...@@ -187,8 +191,9 @@ exit_survey_questions = { ...@@ -187,8 +191,9 @@ exit_survey_questions = {
'I don\'t know', 'I don\'t know',
]}, ]},
{'type' : 'survey_radio', #We used to have two of these questions, one for their mom and one for their dad. That might not make sense for some students.
'question_name' : 'survey__engineering', {'type' : 'radio',
'question_name' : 'engineering',
'label' : 'What is the highest level of schooling completed by one of your parents? (Please choose the answer you think fits best.)', 'label' : 'What is the highest level of schooling completed by one of your parents? (Please choose the answer you think fits best.)',
'choices' : [ 'choices' : [
'PhD degree', 'PhD degree',
......
...@@ -465,7 +465,10 @@ def record_exit_survey(request): ...@@ -465,7 +465,10 @@ def record_exit_survey(request):
if request.method != "POST" or not settings.END_COURSE_ENABLED: if request.method != "POST" or not settings.END_COURSE_ENABLED:
raise Http404 raise Http404
response = { key : value for key,value in request.POST.items() if key.startswith("survey_") } if 'survey_results' not in request.POST:
return HttpResponse(json.dumps({'success':False, 'error':'No survey responses were found.'}))
response = json.loads(request.POST['survey_results'])
up = UserProfile.objects.get(user=request.user) up = UserProfile.objects.get(user=request.user)
......
...@@ -182,10 +182,16 @@ $(function() { ...@@ -182,10 +182,16 @@ $(function() {
//Grab the values from the survey_fieldset //Grab the values from the survey_fieldset
var serializedArray = inputs.serializeArray(); var serializedArray = inputs.serializeArray();
for (var i = 0; i < serializedArray.length; i++) { for (var i = 0; i < serializedArray.length; i++) {
values[ serializedArray[i]['name'] ] = serializedArray[i]['value']; var key = serializedArray[i]['name'];
var value = serializedArray[i]['value'];
if ( key in values && values[key] != null) {
values[key].push( value );
} else {
values[key] = [value];
}
} }
postJSON('/record_exit_survey', values, function(data) { postJSON('/record_exit_survey', {'survey_results' : JSON.stringify(values)}, function(data) {
if (true || data.success) { if (true || data.success) {
$("#survey").html("<h1>Survey Response Recorded</h1><p>Thank you for filling out the survey!</p>"); $("#survey").html("<h1>Survey Response Recorded</h1><p>Thank you for filling out the survey!</p>");
......
...@@ -5,7 +5,16 @@ ...@@ -5,7 +5,16 @@
<li class="survey_radio"> <li class="survey_radio">
<label>${label}</label><br/> <label>${label}</label><br/>
%for choice in choices: %for choice in choices:
<input type="radio" name="${question_name}" value="${choice}"/>${choice}<br> <input type="radio" name="${question_name}" value="${choice}" align="BASELINE"/>${choice}<br>
%endfor
</li>
</%def>
<%def name="survey_select_many(question_name, label, choices)">
<li class="survey_select_many">
<label>${label}</label><br/>
%for choice in choices:
<input type="checkbox" name="${question_name}" value="${choice}" align="BASELINE"/>${choice}<br>
%endfor %endfor
</li> </li>
</%def> </%def>
...@@ -29,13 +38,16 @@ ...@@ -29,13 +38,16 @@
<ul> <ul>
%for survey_question in survey_list: %for survey_question in survey_list:
%if survey_question['type'] == 'survey_radio': %if survey_question['type'] == 'radio':
${survey_radio(survey_question['question_name'], survey_question['label'], survey_question['choices']) } ${survey_radio(survey_question['question_name'], survey_question['label'], survey_question['choices']) }
%elif survey_question['type'] == 'survey_checkbox': %elif survey_question['type'] == 'select_many':
${survey_select_many(survey_question['question_name'], survey_question['label'], survey_question['choices']) }
%elif survey_question['type'] == 'checkbox':
${survey_checkbox(survey_question['question_name'], survey_question['label']) } ${survey_checkbox(survey_question['question_name'], survey_question['label']) }
%elif survey_question['type'] == 'survey_short_field': %elif survey_question['type'] == 'short_field':
${survey_short_field(survey_question['question_name'], survey_question['label']) } ${survey_short_field(survey_question['question_name'], survey_question['label']) }
%endif %endif
%endfor %endfor
......
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