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
14c31001
Commit
14c31001
authored
Oct 07, 2015
by
Zia Fazal
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
minimum score percentage rounded
round before converting a decimal into integer
parent
ee0cd9e8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
3 deletions
+25
-3
lms/djangoapps/courseware/tests/test_entrance_exam.py
+22
-0
lms/templates/courseware/courseware.html
+3
-3
No files found.
lms/djangoapps/courseware/tests/test_entrance_exam.py
View file @
14c31001
...
...
@@ -316,6 +316,28 @@ class EntranceExamTestCases(LoginEnrollmentTestCase, ModuleStoreTestCase):
self
.
assertEqual
(
resp
.
status_code
,
200
)
self
.
assertIn
(
'To access course materials, you must score'
,
resp
.
content
)
def
test_entrance_exam_requirement_message_with_correct_percentage
(
self
):
"""
Unit Test: entrance exam requirement message should be present in response
and percentage of required score should be rounded as expected
"""
minimum_score_pct
=
29
self
.
course
.
entrance_exam_minimum_score_pct
=
float
(
minimum_score_pct
)
/
100
modulestore
()
.
update_item
(
self
.
course
,
self
.
request
.
user
.
id
)
# pylint: disable=no-member
url
=
reverse
(
'courseware_section'
,
kwargs
=
{
'course_id'
:
unicode
(
self
.
course
.
id
),
'chapter'
:
self
.
entrance_exam
.
location
.
name
,
'section'
:
self
.
exam_1
.
location
.
name
}
)
resp
=
self
.
client
.
get
(
url
)
self
.
assertEqual
(
resp
.
status_code
,
200
)
self
.
assertIn
(
'To access course materials, you must score {required_score}
%
or higher'
.
format
(
required_score
=
minimum_score_pct
),
resp
.
content
)
def
test_entrance_exam_requirement_message_hidden
(
self
):
"""
Unit Test: entrance exam message should not be present outside the context of entrance exam subsection.
...
...
lms/templates/courseware/courseware.html
View file @
14c31001
...
...
@@ -202,14 +202,14 @@ ${fragment.foot_html()}
<p
class=
"sequential-status-message"
>
${_('To access course materials, you must score {required_score}% or higher on this \
exam. Your current score is {current_score}%.').format(
required_score=int(
course.entrance_exam_minimum_score_pct * 100
),
current_score=int(
entrance_exam_current_score * 100
)
required_score=int(
round(course.entrance_exam_minimum_score_pct * 100)
),
current_score=int(
round(entrance_exam_current_score * 100)
)
)}
</p>
% else:
<p
class=
"sequential-status-message"
>
${_('Your score is {current_score}%. You have passed the entrance exam.').format(
current_score=int(
entrance_exam_current_score * 100
)
current_score=int(
round(entrance_exam_current_score * 100)
)
)}
</p>
% endif
...
...
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