app/controllers/response_controller.rb
def update
    return unless action_allowed?

    # the response to be updated
    @response = Response.find(params[:id])

    msg = ""
    begin
      @map = @response.map
      @response.update_attribute('additional_comment', params[:review][:comments])
      @questionnaire = set_questionnaire

      questions = sort_questions(@questionnaire.questions)

      unless params[:responses].nil? # for some rubrics, there might be no questions but only file submission (Dr. Ayala's rubric)
        create_answers(params, questions)
      end

      if (params['isSubmit'] && (params['isSubmit'].eql?'Yes'))
        # Update the submission flag.
        @response.update_attribute('is_submitted', true)
      else
        @response.update_attribute('is_submitted', false)
      end

      if (@map.is_a? ReviewResponseMap) && @response.is_submitted && @response.significant_difference?
        @response.notify_instructor_on_difference
      end

    rescue
      msg = "Your response was not saved. Cause:189 #{$ERROR_INFO}"
    end
    redirect_to controller: 'response', action: 'saving', auto_metareview: params[:auto_metareview], id: @map.map_id, return: params[:return], msg: msg, save_options: params[:save_options], volume: params[:volume], plagiarism: params[:plagiarism], tone_p: params[:tone_p], tone_n: params[:tone_n], tone_ng: params[:tone_ng]
  end
# Update the response and answers when student "edit" existing response
Update the response and answers when student "edit" existing response
Update the response and answers when student " edit " existing response
def update
    return unless action_allowed?
    @response = Response.find(params[:id])
    msg = ""
    begin
      @map = @response.map
      @response.update_attribute('additional_comment', params[:review][:comments])
      @questionnaire = set_questionnaire
      questions = sort_questions(@questionnaire.questions)
      unless params[:responses].nil? 
        create_answers(params, questions)
      end
      if (params['isSubmit'] && (params['isSubmit'].eql?'Yes'))
        @response.update_attribute('is_submitted', true)
      else
        @response.update_attribute('is_submitted', false)
      end
      if (@map.is_a? ReviewResponseMap) && @response.is_submitted && @response.significant_difference?
        @response.notify_instructor_on_difference
      end
    rescue
      msg = "Your response was not saved. Cause:189 #{$ERROR_INFO}"
    end
    redirect_to controller: 'response', action: 'saving', auto_metareview: params[:auto_metareview], id: @map.map_id, return: params[:return], msg: msg, save_options: params[:save_options], volume: params[:volume], plagiarism: params[:plagiarism], tone_p: params[:tone_p], tone_n: params[:tone_n], tone_ng: params[:tone_ng]
  end
def update return unless action_allowed? @response = Response . find ( params [ :id ] ) msg = "" begin @map = @response . map @response . update_attribute ( 'additional_comment' , params [ :review ] [ :comments ] ) @questionnaire = set_questionnaire questions = sort_questions ( @questionnaire . questions ) unless params [ :responses ] . nil? create_answers ( params , questions ) end if ( params [ 'isSubmit' ] && ( params [ 'isSubmit' ] . eql? 'Yes' ) ) @response . update_attribute ( 'is_submitted' , true ) else @response . update_attribute ( 'is_submitted' , false ) end if ( @map . is_a? ReviewResponseMap ) && @response . is_submitted && @response . significant_difference? @response . notify_instructor_on_difference end rescue msg = "Your response was not saved. Cause:189 #{$ERROR_INFO}" end redirect_to controller : 'response' , action : 'saving' , auto_metareview : params [ :auto_metareview ] , id : @map . map_id , return : params [ :return ] , msg : msg , save_options : params [ :save_options ] , volume : params [ :volume ] , plagiarism : params [ :plagiarism ] , tone_p : params [ :tone_p ] , tone_n : params [ :tone_n ] , tone_ng : params [ :tone_ng ] end
Update the response and answers when student "edit" existing response
Update the response and answers when student " edit " existing response
# the response to be updated # for some rubrics, there might be no questions but only file submission (Dr. Ayala's rubric) # Update the submission flag.