Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
6b7ff213
Commit
6b7ff213
authored
Jun 05, 2012
by
Bridger Maxwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moved the survey_questions file to student module.
parent
e637d69f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
14 deletions
+23
-14
djangoapps/courseware/views.py
+2
-14
djangoapps/student/survey_questions.py
+21
-0
No files found.
djangoapps/courseware/views.py
View file @
6b7ff213
...
...
@@ -28,7 +28,7 @@ from student.models import UserProfile
from
student.views
import
student_took_survey
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.modules.capa_module
...
...
@@ -96,19 +96,7 @@ def profile(request, student_id = None):
took_survey
=
False
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
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
survey_list
=
exit_survey_list_for_student
(
student
)
# certificate_requested determines if the student has requested a certificate
certificate_requested
=
False
...
...
djangoapps/
courseware
/survey_questions.py
→
djangoapps/
student
/survey_questions.py
View file @
6b7ff213
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
=
{
'common_questions'
:
[
{
'type'
:
'checkbox'
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment