Coursemology/coursemology.org — pull request #295 by subakarank (2014-11-14 07:27:19+00:00)
Title: Survey reset

Reset Survey:
=============
Affected files:
1) config/routes
Add:
post "surveys/:id/reset" => "surveys#reset", as: :survey_stats_reset

2) app/controllers/surveys_controller
Add Action:

def reset

SurveySubmission.where(survey_id: params[:id]).destroy_all
respond_to do |format|
format.html { redirect_to(course_survey_stats_path(@course, @survey), notice: 'Survey has been reset successfully') }
end
end

3) app/views/surveys/stats.html.erb
Add Reset buttton:

<%= button_to "Reset Survey", {action: 'reset'}, class:'btn-danger', data:{ confirm: 'All responded answers will be removed. Are you sure to continue?', disable_with: 'Loading..' } %>

Feature: Lecturer is able to reset his/her survey. Once he reset all the answers will be destroyed. Users are required to do survey again.

Fixed : https://github.com/Coursemology/coursemology.org/issues/140