Sha256: 219ee3baeb3fb3445ca4f6db77b53faf6df51be3c721c87f074e8c92ec4a9a46
Contents?: true
Size: 1.15 KB
Versions: 1
Compression:
Stored size: 1.15 KB
Contents
class SprintTaskLocksController < ApplicationController before_filter :authenticate_user! before_filter :find_sprint_and_task attr_reader :sprint, :task def create if sprint.completed? render json: {base: ["The Sprint is completed. You cannot check out or check in tasks."]}, status: :unprocessable_entity return end if task.checked_out?(sprint) render json: {base: ["Task ##{task.shorthand} is already checked out"]}, status: 422 else task.check_out!(sprint, current_user) head :ok end end def destroy if sprint.completed? render json: {base: ["The Sprint is completed. You cannot check out or check in tasks."]}, status: :unprocessable_entity return end if task.checked_out_by_me?(sprint, current_user) task.check_in!(sprint) head :ok elsif task.checked_out?(sprint) render json: {base: ["Ticket ##{task.shorthand} is checked out. You cannot check it in"]}, status: 422 else head :ok end end private def find_sprint_and_task @sprint = Sprint.find params[:id] @task = Task.find params[:task_id] end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
houston-core-0.5.0.beta1 | app/controllers/sprint_task_locks_controller.rb |