Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refresh page after correct answer with prerequisites #411

Merged
merged 1 commit into from
Jul 3, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions common/lib/xmodule/xmodule/js/src/capa/display.js
Original file line number Diff line number Diff line change
Expand Up @@ -632,6 +632,9 @@
that.el.trigger('contentChanged', [that.id, response.contents, response]);
that.render(response.contents, that.focus_on_submit_notification);
that.updateProgress(response);
if (response.refresh_page) {
window.location = window.location;
}
break;
default:
that.saveNotification.hide();
Expand Down
5 changes: 5 additions & 0 deletions lms/djangoapps/courseware/module_render.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
replace_static_urls,
wrap_xblock
)
from openedx.core.lib.gating import api as gating_api
from student.models import anonymous_id_for_user, user_by_anonymous_id
from student.roles import CourseBetaTesterRole
from track import contexts
Expand Down Expand Up @@ -980,6 +981,10 @@ def _invoke_xblock_handler(request, course_id, usage_id, handler, suffix, course
try:
with tracker.get_tracker().context(tracking_context_name, tracking_context):
resp = instance.handle(handler, req, suffix)
is_prereq = gating_api.is_prerequisite(course_id, instance._parent_block.parent)
r = json.loads(resp.app_iter[0])
if is_prereq and r.get('current_score', 0) >= r.get('total_possible', 1):
resp = append_data_to_webob_response(resp, {'refresh_page': True})
if suffix == 'problem_check' \
and course \
and getattr(course, 'entrance_exam_enabled', False) \
Expand Down