Prod build process
This commit is contained in:
@@ -18,41 +18,14 @@ module IdCardPrinterService
|
||||
template_groups = break_up_by_template(pl_plan_keys)
|
||||
template_groups.each do |card_template, template_pl_plan_keys|
|
||||
batch = IdCard::PrintData.where(pl_plan_key: template_pl_plan_keys)
|
||||
# all_template_cards.in_batches(of: 75).each_with_index do |batch, index|
|
||||
jasper_batch_id = "#{template_pl_plan_keys.join('_')}-#{Time.current.utc.to_i}"
|
||||
# binding.pry
|
||||
batch.update!(jasper_batch_id: jasper_batch_id)
|
||||
if @layout == "PrintCard"
|
||||
add_dependent_cards(batch)
|
||||
end
|
||||
batch_pdf = IdCardPrinterService::PdfBatchProcessor.new(card_template, jasper_batch_id, @layout).call
|
||||
pdf_array << batch_pdf
|
||||
# end
|
||||
# jasper_batches = break_into_jasper_batches(group_pl_plan_keys)
|
||||
# jasper_batches.each_with_index do |batch, index|
|
||||
# jasper_batch_id = "#{group_pl_plan_keys.join('_')}-#{index + 1}-#{Time.current.utc.to_i}"
|
||||
# binding.pry
|
||||
# batch.update!(jasper_batch_id: jasper_batch_id)
|
||||
# if @layout == "PrintCard"
|
||||
# add_dependent_cards(batch)
|
||||
# end
|
||||
# batch_pdf = IdCardPrinterService::PdfBatchProcessor.new(card_template, jasper_batch_id, @layout).call
|
||||
# pdf_array << batch_pdf
|
||||
# end
|
||||
jasper_batch_id = "#{template_pl_plan_keys.join('_')}-#{Time.current.utc.to_i}"
|
||||
batch.update!(jasper_batch_id: jasper_batch_id)
|
||||
if @layout == "PrintCard"
|
||||
add_dependent_cards(batch)
|
||||
end
|
||||
batch_pdf = IdCardPrinterService::PdfBatchProcessor.new(card_template, jasper_batch_id, @layout).call
|
||||
pdf_array << batch_pdf
|
||||
end
|
||||
# @employers_member_keys.each do |emk|
|
||||
# employer_jasper_batches = IdCard::PrintData.where(pl_plan_key: emk[:pl_plan_key]).pluck(:network_logo_id).uniq
|
||||
# employer_jasper_batches.each do |batch_network_logo|
|
||||
# jasper_batch_id = "#{emk[:pl_plan_key]}-#{Time.current.utc.to_i}"
|
||||
# batch = IdCard::PrintData.where(pl_plan_key: emk[:pl_plan_key], network_logo_id: batch_network_logo)
|
||||
# # batch = employer_card_data.where(network_logo_id: batch_network_logo)
|
||||
# batch.update!(jasper_batch_id: jasper_batch_id)
|
||||
# batch_pdf = IdCardPrinterService::PdfBatchProcessor.new(emk[:pl_plan_key], batch_network_logo, jasper_batch_id, @layout).call
|
||||
# pdf_array << batch_pdf
|
||||
# end
|
||||
# end
|
||||
|
||||
|
||||
|
||||
group_pdfs = combine_pdfs(pdf_array)
|
||||
group_pdfs
|
||||
@@ -67,13 +40,6 @@ module IdCardPrinterService
|
||||
.compact_blank
|
||||
end
|
||||
|
||||
def break_into_jasper_batches(pl_plan_keys)
|
||||
all_cards = IdCard::PrintData.where(pl_plan_key: pl_plan_keys)
|
||||
binding.pry
|
||||
jasper_batches = all_cards.each_slice(75).to_a
|
||||
jasper_batches
|
||||
end
|
||||
|
||||
def add_dependent_cards(batch)
|
||||
batch.where.not(dependent_1: [nil, ""]).find_each do |member_card|
|
||||
dependent_card = member_card.dup
|
||||
|
||||
Reference in New Issue
Block a user