Sha256: 08a362c8c5ac941749c7ca3739ed5cf4f4a6a27ac4918ecbd38e693ed8b4f0f6

Contents?: true

Size: 972 Bytes

Versions: 21

Compression:

Stored size: 972 Bytes

Contents

require_dependency "think_feel_do_engine/application_controller"

module ThinkFeelDoEngine
  module Participants
    # Updates the completion of assigned tasks for a participant
    class TaskStatusController < ApplicationController
      before_action :authenticate_participant!

      rescue_from ActiveRecord::RecordNotFound, with: :record_not_found

      def update
        @task_status = current_participant
                       .active_membership
                       .task_statuses
                       .find(params[:id])

        begin
          if @task_status.engagements.build && @task_status.mark_complete
            render nothing: true, status: 200
          else
            render nothing: true, status: 400
          end
        rescue ActiveRecord::InvalidForeignKey
          render nothing: true, status: 400
        end
      end

      private

      def record_not_found
        render nothing: true, status: 404
      end
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
think_feel_do_engine-3.16.3 app/controllers/think_feel_do_engine/participants/task_status_controller.rb
think_feel_do_engine-3.16.2 app/controllers/think_feel_do_engine/participants/task_status_controller.rb
think_feel_do_engine-3.16.1 app/controllers/think_feel_do_engine/participants/task_status_controller.rb
think_feel_do_engine-3.15.7 app/controllers/think_feel_do_engine/participants/task_status_controller.rb
think_feel_do_engine-3.16.0 app/controllers/think_feel_do_engine/participants/task_status_controller.rb
think_feel_do_engine-3.15.6 app/controllers/think_feel_do_engine/participants/task_status_controller.rb
think_feel_do_engine-3.15.5 app/controllers/think_feel_do_engine/participants/task_status_controller.rb
think_feel_do_engine-3.15.4 app/controllers/think_feel_do_engine/participants/task_status_controller.rb
think_feel_do_engine-3.15.3 app/controllers/think_feel_do_engine/participants/task_status_controller.rb
think_feel_do_engine-3.15.2 app/controllers/think_feel_do_engine/participants/task_status_controller.rb
think_feel_do_engine-3.15.1 app/controllers/think_feel_do_engine/participants/task_status_controller.rb
think_feel_do_engine-3.15.0 app/controllers/think_feel_do_engine/participants/task_status_controller.rb
think_feel_do_engine-3.14.9 app/controllers/think_feel_do_engine/participants/task_status_controller.rb
think_feel_do_engine-3.14.8 app/controllers/think_feel_do_engine/participants/task_status_controller.rb
think_feel_do_engine-3.14.7 app/controllers/think_feel_do_engine/participants/task_status_controller.rb
think_feel_do_engine-3.14.6 app/controllers/think_feel_do_engine/participants/task_status_controller.rb
think_feel_do_engine-3.14.5 app/controllers/think_feel_do_engine/participants/task_status_controller.rb
think_feel_do_engine-3.14.4 app/controllers/think_feel_do_engine/participants/task_status_controller.rb
think_feel_do_engine-3.14.3 app/controllers/think_feel_do_engine/participants/task_status_controller.rb
think_feel_do_engine-3.14.2 app/controllers/think_feel_do_engine/participants/task_status_controller.rb