fix rubocop

This commit is contained in:
Pete Matsyburka
2026-04-02 12:48:28 +03:00
parent bd7ad5fce8
commit eaedaa96bb
22 changed files with 37 additions and 28 deletions
+1 -1
View File
@@ -3,7 +3,7 @@
module GenerateCertificate
SIZE = 2**11
Pkcs12Struct = Struct.new(:certificate, :ca_certs, keyword_init: true)
Pkcs12Struct = Struct.new(:certificate, :ca_certs)
module_function
+2 -2
View File
@@ -92,7 +92,7 @@ module Params
def in_path(params, path = [], skip_blank: false)
old_path = @current_path
@current_path = [old_path, *path].compact_blank.map(&:to_s).join('.')
@current_path = [old_path, *path].compact_blank.join('.')
param = params.dig(*path)
param = nil if skip_blank && param.blank?
@@ -106,7 +106,7 @@ module Params
old_path = @current_path
params.dig(*path)&.each_with_index do |item, index|
@current_path = [old_path, [*path].map(&:to_s).join('.') + "[#{index}]"].compact_blank.join('.')
@current_path = [old_path, [*path].join('.') + "[#{index}]"].compact_blank.join('.')
yield item if item
end
+3 -3
View File
@@ -438,8 +438,8 @@ module Submissions
composer.text(I18n.t('event_log'), font_size: 12, padding: [10, 0, 20, 0])
submitter_versions_index = submission.submitters.preload(:submitter_versions).each_with_object({}) do |s, h|
h[s.id] = s.submitter_versions.to_a.sort_by(&:created_at)
submitter_versions_index = submission.submitters.preload(:submitter_versions).to_h do |s|
[s.id, s.submitter_versions.to_a.sort_by(&:created_at)]
end
events_data = submission.submission_events.sort_by(&:event_timestamp).filter_map do |event|
@@ -475,7 +475,7 @@ module Submissions
].join("\n")
elsif event.event_type == 'delegate_form'
from = event.data['old_email'].presence ||
versions.reverse.find { |v| v.created_at <= event.event_timestamp }&.then { |v| v.name || v.phone }
versions.rfind { |v| v.created_at <= event.event_timestamp }&.then { |v| v.name || v.phone }
I18n.t('submission_event_names.delegate_form_by_html', from:, to: event.data['email'])
elsif event.event_type.include?('send_')
I18n.t("submission_event_names.#{event.event_type}_to_html", submitter_name:)
+1 -1
View File
@@ -58,7 +58,7 @@ module Submissions
end
def build_table_rows(submissions, expires_at: nil)
submissions.preload(submitters: [attachments_attachments: :blob, documents_attachments: :blob])
submissions.preload(submitters: [{ attachments_attachments: :blob, documents_attachments: :blob }])
.find_each.map do |submission|
submission_data = []
submitters_count = submission.submitters.size
+2 -2
View File
@@ -15,9 +15,9 @@ module Submitters
ActiveRecord::Associations::Preloader.new(
records: [submitter],
associations: if with_documents
[documents_attachments: :blob, attachments_attachments: :blob]
[{ documents_attachments: :blob, attachments_attachments: :blob }]
elsif with_values
[attachments_attachments: :blob]
[{ attachments_attachments: :blob }]
end
).call
+1 -1
View File
@@ -12,7 +12,7 @@ module Submitters
def call(submitter, expires_at: Accounts.link_expires_at(Account.new(id: submitter.account_id)))
ActiveRecord::Associations::Preloader.new(
records: [submitter], associations: [documents_attachments: :blob, attachments_attachments: :blob]
records: [submitter], associations: [{ documents_attachments: :blob, attachments_attachments: :blob }]
).call
values = build_values_array(submitter, expires_at:)
+2 -2
View File
@@ -4,7 +4,7 @@ module Templates
module DetectFields
module_function
TextFieldBox = Struct.new(:x, :y, :w, :h, keyword_init: true) do
TextFieldBox = Struct.new(:x, :y, :w, :h) do
def endy
@endy ||= y + h
end
@@ -14,7 +14,7 @@ module Templates
end
end
PageNode = Struct.new(:prev, :next, :elem, :page, :attachment_uuid, keyword_init: true)
PageNode = Struct.new(:prev, :next, :elem, :page, :attachment_uuid)
DATE_REGEXP = /
(?:
+1 -1
View File
@@ -4,7 +4,7 @@ module Templates
module ImageToFields
module_function
Field = Struct.new(:type, :x, :y, :w, :h, :confidence, keyword_init: true) do
Field = Struct.new(:type, :x, :y, :w, :h, :confidence) do
def endy
@endy ||= y + h
end
+1 -1
View File
@@ -34,7 +34,7 @@ module Templates
if index.positive? && pdf_fields.present?
preview_document = template.schema[index - 1]
preview_document_last_field = template.fields.reverse.find do |f|
preview_document_last_field = template.fields.rfind do |f|
f['areas']&.any? do |a|
a['attachment_uuid'] == preview_document[:attachment_uuid]
end