24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
# File 'app/controllers/proctored_exams_controller.rb', line 24
def start_quiz
= {
"Content-Type" => "application/json",
}
plugin = PluginSetting.find_by(name: "quiz_proctor")
query = {
student_id: @current_user.id,
proctor_code: params[:proctor_code],
}.to_query
quiz = HTTParty.get(
"#{plugin.settings[:adhesion_url]}/api/proctored_exams?#{query}",
headers: ,
)
if quiz.parsed_response["error"].present?
flash[:error] = quiz.parsed_response["error"]
redirect_to proctored_exams_path
else
quiz = quiz.parsed_response
session[:is_proctored] = true
session[:proctor_access_code] = quiz["proctor_access_code"]
redirect_to course_quiz_take_path quiz["quiz"]["course_id"], quiz["quiz"]["exam_id"]
end
end
|