allow to resent copy email

This commit is contained in:
Pete Matsyburka
2024-02-25 02:00:18 +02:00
parent 2bd023e5d0
commit fcd40308ee
14 changed files with 103 additions and 65 deletions
+1 -16
View File
@@ -6,23 +6,8 @@ class SubmissionsController < ApplicationController
load_and_authorize_resource :submission, only: %i[show destroy]
PRELOAD_ALL_PAGES_AMOUNT = 200
def show
ActiveRecord::Associations::Preloader.new(
records: [@submission],
associations: [:template, { template_schema_documents: :blob }]
).call
total_pages =
@submission.template_schema_documents.sum { |e| e.metadata.dig('pdf', 'number_of_pages').to_i }
if total_pages < PRELOAD_ALL_PAGES_AMOUNT
ActiveRecord::Associations::Preloader.new(
records: @submission.template_schema_documents,
associations: [:blob, { preview_images_attachments: :blob }]
).call
end
@submission = Submissions.preload_with_pages(@submission)
render :show, layout: 'plain'
end