Added error handling for increasing pages

This commit is contained in:
2024-08-13 14:52:22 +02:00
parent e4c19850b1
commit bf78c1537a

View File

@@ -42,6 +42,7 @@ class Operator::JobsController < ApplicationController
def update def update
respond_to do |format| respond_to do |format|
if @job.update(job_params) if @job.update(job_params)
broadcast_update_job broadcast_update_job
format.html { redirect_to operator_jobs_url, notice: "Job was successfully updated." } format.html { redirect_to operator_jobs_url, notice: "Job was successfully updated." }
else else
@@ -75,7 +76,11 @@ class Operator::JobsController < ApplicationController
end end
def increment_page def increment_page
@job.increment_page(params[:din]) if @job.increment_page(params[:din])
flash[:notice] = "Job was successfully updated"
else
flash[:alert] = "Job could not be updated"
end
respond_to do |format| respond_to do |format|
broadcast_update_job broadcast_update_job
@@ -90,7 +95,6 @@ class Operator::JobsController < ApplicationController
flash[:alert] = "Job could not be updated" flash[:alert] = "Job could not be updated"
end end
respond_to do |format| respond_to do |format|
broadcast_update_job broadcast_update_job
format.html { redirect_to operator_jobs_url } format.html { redirect_to operator_jobs_url }