Skip to content

Commit

Permalink
Properly scope missed recipiient count (#2017)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattwr18 authored Sep 6, 2024
1 parent 7f4f2c0 commit 37125f6
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions app/controllers/requests_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,16 @@ def create
resize_image_files if request_params[:files].present?
@request = @organization.requests.new(request_params.merge(user: current_user))
if @request.save
recipient_count = @request.organization.contributors.active.with_tags(@request.tag_list).count
if @request.planned?
redirect_to organization_requests_path(@organization, filter: :planned), flash: {
success: I18n.t('request.schedule_request_success',
count: Contributor.active.with_tags(@request.tag_list).count,
count: recipient_count,
scheduled_datetime: I18n.l(@request.schedule_send_for, format: :long))
}
else
redirect_to organization_request_path(@organization.id, @request),
flash: { success: I18n.t('request.success', count: @request.stats[:counts][:recipients]) }
flash: { success: I18n.t('request.success', count: recipient_count) }
end
else
render :new, status: :unprocessable_entity
Expand Down

0 comments on commit 37125f6

Please sign in to comment.