Newer
Older
render_args.update(kwargs)
return render_course_page(
pctx, template, render_args,
allow_instant_flow_requests=False)
if request.method == "POST":
if "submit" not in request.POST:
raise SuspiciousOperation("odd POST parameters")
if not flow_session.in_progress:
raise PermissionDenied("Can't end a session that's already ended")
# Actually end the flow session
request.session["flow_session_id"] = None
grade_info = finish_flow_session(fctx, flow_session, current_access_rule)
if answered_count + unanswered_count:
if grade_info is None:
messages.add_message(request, messages.INFO,
"A grade for your work has not yet been assigned. "
"Please check back later for grade information.")
return render_finish_response(
"course/flow-completion.html",
last_page_nr=None,
completion_text=completion_text)
return render_finish_response(
"course/flow-completion-grade.html",
completion_text=completion_text,
grade_info=grade_info)
else:
# {{{ no grade
return render_finish_response(
"course/flow-completion.html",
last_page_nr=None,
completion_text=completion_text)
# }}}
if (answered_count + unanswered_count == 0
and fctx.flow_commit_sha == fctx.course_commit_sha):
# Not serious--no questions in flow, and no new version available.
# No need to end the flow visit.
return render_finish_response(
"course/flow-completion.html",
completion_text=completion_text)
elif not flow_session.in_progress:
# Just reviewing: re-show grades.
grade_info = gather_grade_info(flow_session, answer_visits)
return render_finish_response(
"course/flow-completion-grade.html",
completion_text=completion_text,
grade_info=grade_info)
else:
# confirm ending flow
return render_finish_response(
"course/flow-confirm-completion.html",
answered_count=answered_count,
unanswered_count=unanswered_count,
total_count=answered_count+unanswered_count)
# }}}
# vim: foldmethod=marker