Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle task save failure #3386

Merged
merged 1 commit into from
Nov 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion app/controllers/admin/tasks_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ class Admin::TasksController < Admin::BaseAdminController
before_action :ensure_service_operator
before_action :load_claim
before_action :ensure_task_has_not_already_been_completed, only: [:create]
before_action :load_matching_claims, only: [:show], if: -> { params[:name] == "matching_details" }
before_action :load_matching_claims, only: [:show], if: :load_matching_claims?

def index
@claim_checking_tasks = ClaimCheckingTasks.new(@claim)
Expand All @@ -29,6 +29,7 @@ def create
if @task.save
redirect_to @task_pagination.next_task_path
else
load_matching_claims if load_matching_claims?
@tasks_presenter = @claim.policy::AdminTasksPresenter.new(@claim)
render @task.name
end
Expand Down Expand Up @@ -75,6 +76,10 @@ def load_matching_claims
@matching_claims = Claim::MatchingAttributeFinder.new(@claim).matching_claims
end

def load_matching_claims?
params[:name] == "matching_details"
end

def current_task_name
@task.name
end
Expand Down