Class: StudyEngine::AssessmentsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- ApplicationController
- StudyEngine::AssessmentsController
- Defined in:
- app/controllers/study_engine/assessments_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #notification ⇒ Object
- #show ⇒ Object
- #timeout ⇒ Object
- #update ⇒ Object
Methods inherited from ApplicationController
Instance Method Details
#create ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'app/controllers/study_engine/assessments_controller.rb', line 14 def create @assessment = BeginAssessmentForm.new(params[:assessment]) assessment.coordinator = current_user if assessment.save if assessment.by_url? flash.now.notice = "An assessment has been created." ::StudyEngine::Mailer.assessment_url_notification(current_user.email, assessment).deliver_now render :create elsif assessment.by_mail? flash.now.notice = "An assessment has been created." render :create else redirect_to assessment end elsif assessment.restartable? flash.now.alert = "Partial assessment data already exists for this ID number and event. Would you like to resume or restart?" render :restart else flash.now.alert = assessment.errors..join(", ") render :index end end |
#edit ⇒ Object
49 50 51 |
# File 'app/controllers/study_engine/assessments_controller.rb', line 49 def edit redirect_to assessment end |
#index ⇒ Object
8 9 10 11 12 |
# File 'app/controllers/study_engine/assessments_controller.rb', line 8 def index @welcome_content = StudyEngine.welcome_content @assessment = BeginAssessmentForm.new assessment.coordinator = current_user end |
#notification ⇒ Object
64 65 66 67 |
# File 'app/controllers/study_engine/assessments_controller.rb', line 64 def notification send_notification head :ok end |
#show ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 |
# File 'app/controllers/study_engine/assessments_controller.rb', line 37 def show if assessment.complete? if assessment.completed_at.nil? assessment.touch :completed_at send_notification end render :complete else render :show end end |
#timeout ⇒ Object
58 59 60 61 62 |
# File 'app/controllers/study_engine/assessments_controller.rb', line 58 def timeout @assessment = BeginAssessmentForm.new_from_model(assessment) flash.now.alert = "Assessment timed out due to inactivity. Would you like to resume or restart?" render :restart end |
#update ⇒ Object
53 54 55 56 |
# File 'app/controllers/study_engine/assessments_controller.rb', line 53 def update assessment.save_answer Answer.new(question: CatEngine::Question.new(params[:cat_engine_question])) redirect_to assessment end |