Skip to content

Commit

Permalink
Merge branch 'master' into EDUCATOR-927
Browse files Browse the repository at this point in the history
  • Loading branch information
thallada authored Aug 9, 2017
2 parents fea749d + 952ad87 commit 7c40135
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 2 deletions.
14 changes: 14 additions & 0 deletions edx_proctoring/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,19 @@ def get_review_policy_by_exam_id(exam_id):
return ProctoredExamReviewPolicySerializer(exam_review_policy).data


def _get_review_policy_by_exam_id(exam_id):
"""
Looks up exam by the primary key. Returns None if not found
Returns review_policy field of the Django ORM object
"""
try:
exam_review_policy = get_review_policy_by_exam_id(exam_id)
return ProctoredExamReviewPolicySerializer(exam_review_policy).data['review_policy']
except ProctoredExamReviewPolicyNotFoundException:
return None


def update_exam(exam_id, exam_name=None, time_limit_mins=None, due_date=constants.MINIMUM_TIME,
is_proctored=None, is_practice_exam=None, external_id=None, is_active=None, hide_after_due=None):
"""
Expand Down Expand Up @@ -1679,6 +1692,7 @@ def _get_proctored_exam_context(exam, attempt, course_id, is_practice_exam=False
) if attempt else '',
'link_urls': settings.PROCTORING_SETTINGS.get('LINK_URLS', {}),
'tech_support_email': settings.TECH_SUPPORT_EMAIL,
'exam_review_policy': _get_review_policy_by_exam_id(exam['id']),
}


Expand Down
Binary file modified edx_proctoring/locale/pt_PT/LC_MESSAGES/django.mo
Binary file not shown.
2 changes: 1 addition & 1 deletion edx_proctoring/locale/pt_PT/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ msgstr ""
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-02-15 17:16-0500\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: Manuela Silva <[email protected]>, 2017\n"
"Last-Translator: Developer QUEO <[email protected]>, 2017\n"
"Language-Team: Portuguese (Portugal) (https://www.transifex.com/open-edx/teams/6205/pt_PT/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
Expand Down
Binary file modified edx_proctoring/locale/pt_PT/LC_MESSAGES/djangojs.mo
Binary file not shown.
2 changes: 1 addition & 1 deletion edx_proctoring/locale/pt_PT/LC_MESSAGES/djangojs.po
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ msgstr ""
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-02-15 17:16-0500\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: Manuela Silva <[email protected]>, 2017\n"
"Last-Translator: Developer QUEO <[email protected]>, 2017\n"
"Language-Team: Portuguese (Portugal) (https://www.transifex.com/open-edx/teams/6205/pt_PT/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
Expand Down
21 changes: 21 additions & 0 deletions edx_proctoring/templates/proctored_exam/ready_to_start.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,29 @@ <h3>
&#8226; You cannot stop the timer once you start. </br>
&#8226; If time expires before you finish your exam, your completed answers will be
submitted for review. </br>
&#8226; If you have not taken a proctored exam before using {{ platform_name }} please read
the exam rules and guidelines first. Reading these will ensure you don't accidentally violate
any of the proctored exam rules. {% endblocktrans %}
<a href="{{link_urls.online_proctoring_rules}}" target="_blank">
{% blocktrans %}
Read the {{ platform_name }} Online Proctoring Rules for Learners
{% endblocktrans %}
</a> </br>
</p>
{% if exam_review_policy %}
<h3>
{% blocktrans %}
Additional Exam Rules
{% endblocktrans %}
</h3>
<p>
{% blocktrans %}
In addition to the general exam rules above, the following additions or exceptions apply to this exam: </br> </br>

{{ exam_review_policy }} </br>
{% endblocktrans %}
</p>
{% endif %}
<div>
<button type="button" class="exam-action-button proctored-enter-exam btn btn-pl-primary btn-base" data-action="start" data-exam-id="{{exam_id}}" data-change-state-url="{{change_state_url}}">
{% blocktrans %}
Expand Down
18 changes: 18 additions & 0 deletions edx_proctoring/tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
_are_prerequirements_satisfied,
create_exam_review_policy,
get_review_policy_by_exam_id,
_get_review_policy_by_exam_id,
update_review_policy,
remove_review_policy,
)
Expand Down Expand Up @@ -196,6 +197,23 @@ def test_create_exam_review_policy(self):
self.assertEqual(exam_review_policy['set_by_user']['id'], self.user_id)
self.assertEqual(exam_review_policy['review_policy'], u'allow use of paper')

def test_get_exam_review_policy(self):
"""
Test that creates a new exam policy and tests
that the policy can be properly retrieved
"""
proctored_exam = get_exam_by_id(self.proctored_exam_id)
create_exam_review_policy(
exam_id=proctored_exam['id'],
set_by_user_id=self.user_id,
review_policy=u'allow use of paper'
)

# now get the exam review policy for the proctored exam
exam_review_policy_string = _get_review_policy_by_exam_id(proctored_exam['id'])

self.assertEqual(exam_review_policy_string, u'allow use of paper')

def test_update_exam_review_policy(self):
"""
Test to update existing exam review policy for
Expand Down

0 comments on commit 7c40135

Please sign in to comment.