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

Fixing the label printing issue for Lysate plates #2094

Merged
merged 4 commits into from
Nov 29, 2024
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion .release-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.64.1
3.64.2
2 changes: 1 addition & 1 deletion app/controllers/print_jobs_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def print_job_params
# While we COULD carefully define the current label structure, we gain nothing by doing so and make
# future changes more painful.
permitted[:labels] = params.require(:print_job)[:labels].map(&:permit!)
permitted[:labels_sprint] = params.require(:print_job)[:labels_sprint][:sprint].map(&:permit!)
Copy link
Contributor Author

@dasunpubudumal dasunpubudumal Nov 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is what caused the issue. It only permitted sprint attributes, but not other attributes (interm_x or qc_x; x stands for integers) under labels_sprint.

We should increase test coverage for additional attributes and qc definitions later on as they aren't covered by current tests.

permitted[:labels_sprint] = params.require(:print_job)[:labels_sprint].permit!
end
end

Expand Down
4 changes: 3 additions & 1 deletion app/models/print_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ def print_to_sprint

label_template = get_label_template_by_service('SPrint')

label_array = labels_sprint.values.flatten

# label_array:
# [{
# "right_text"=>"DN9000003B",
Expand All @@ -99,7 +101,7 @@ def print_to_sprint
# "extra_left_text"=>"10-NOV-2020"
# }]

merge_fields_list = labels_sprint * number_of_copies
merge_fields_list = label_array * number_of_copies

# assumes all labels use the same label template
SPrintClient.send_print_request(printer_name, label_template, merge_fields_list)
Expand Down
8 changes: 4 additions & 4 deletions spec/models/print_job_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -188,15 +188,15 @@

describe 'print_to_sprint' do
let(:labels_sprint) do
[
{
{
'sprint' => {
'right_text' => 'DN9000003B',
'left_text' => 'DN9000003B',
'barcode' => 'DN9000003B',
'extra_right_text' => 'DN9000003B LTHR-384 RT',
'extra_left_text' => '10-NOV-2020'
}
]
}
end

it 'will send a print request to SPrintClient' do
Expand All @@ -215,7 +215,7 @@
expect(SPrintClient).to receive(:send_print_request).with(
printer_sprint.name,
label_template_name_sprint,
labels_sprint
labels_sprint.values
)
expect(pj.print_to_sprint).to eq(true)
end
Expand Down
Loading