Skip to content
Open
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
4 changes: 2 additions & 2 deletions app/assets/javascripts/exams.js.erb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ function init_chronometer(page_question, total) {
Timer.start(segundos);
}

function save_question(duration) {
function save_question(duration, interrupt_exam=false) {
Timer.pause();
var form = $('form.edit_exam_response');

Expand All @@ -30,7 +30,7 @@ function save_question(duration) {
$.ajax({
url : post_url,
type: request_method,
data : form_data
data : form_data + "&interrupt_exam=" + interrupt_exam
}).done(function(response){
tempo(response.total_time, 1);
}).fail(function(response){
Expand Down
6 changes: 6 additions & 0 deletions app/controllers/exam_responses_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ def update
SysLog::Actions.log_info do
"[PROVA] Salvou resposta para user_id=#{current_user.try(:id)}, exam_response=#{params[:id]}"
end

if params[:interrupt_exam] == 'true' && exam.uninterrupted
@exam_response.academic_allocation_user.finish_attempt(get_remote_ip)
end

render_exam_response_success_json('updated', total_time_user)
else
SysLog::Actions.log_info do
Expand All @@ -50,6 +55,7 @@ def update
SysLog::Actions.log_info do
"[PROVA] Não salvou resposta para user_id=#{current_user.try(:id)}, exam_response=#{params[:id]} - erro erro com data ou duração - duration_validate: #{duration_validate} - date_validate: #{date_validate} - acu: #{acu.as_json}"
end
acu.finish_attempt(get_remote_ip)
respond_to do |format|
format.js { render :js => "validation_error('#{I18n.t('exam_responses.error.' + 'duration' + '')}');" }
end
Expand Down
2 changes: 1 addition & 1 deletion app/views/exams/open.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
});
if(click_pagination==false){
window.onbeforeunload = function () {
save_question(null);
save_question(null, true);
return "#{I18n.t('exams.open.refresh')}";
}
}
Expand Down