Skip to content

Commit

Permalink
Blinding date_produced for samples and keeping samples order for send… (
Browse files Browse the repository at this point in the history
#2001)

* Blinding date_produced for samples and keeping samples order for sender institution

* Fixes PR reviews

* Fixes PR reviews
  • Loading branch information
leandroradusky committed Apr 19, 2024
1 parent ea1f412 commit e4b2505
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion app/controllers/boxes_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ def load_box

def load_box_samples
samples = @box.samples.preload(:batch, :sample_identifiers)
samples = if @box.blinded? && !params[:unblind]
samples = if @box.blinded? && !params[:unblind] && @box.transferred?
samples.scrambled
else
samples.order(:id)
Expand Down
2 changes: 1 addition & 1 deletion app/documents/label_pdf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def render_sample_details(sample)
text_lines [
"I.N. #{sample.isolate_name}".truncate(22),
"I.M. #{sample.inactivation_method}".truncate(22),
"P.D. #{sample.date_produced.strftime("%m/%d/%Y")}",
"P.D. #{sample.blinded_attribute(:date_produced) { sample.date_produced.strftime("%m/%d/%Y") }}",
], leading: -0.5
end

Expand Down
2 changes: 1 addition & 1 deletion app/models/box.rb
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def detach_from_context

# Returns the full list of sample attributes that can be blinded.
def self.blind_attribute_names
%i[batch_number concentration replicate virus_lineage isolate_name]
%i[batch_number concentration replicate virus_lineage isolate_name date_produced]
end

# Returns true if a sample attribute should be blinded for the current box.
Expand Down
2 changes: 1 addition & 1 deletion app/views/boxes/inventory.csv.csvbuilder
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ csv << [
sample.virus_lineage,
sample.replicate,
sample.concentration,
sample.date_produced.to_date,
sample.blinded_attribute(:date_produced) { sample.date_produced.to_date },
sample.inactivation_method,
sample.media,
]
Expand Down
2 changes: 1 addition & 1 deletion app/views/samples/_barcode_card.haml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
.code
%strong
Production Date:
#{@sample_form.date_produced.try{ strftime("%m/%d/%Y")}}
#{@sample_form.blinded_attribute(:date_produced){ @sample_form.date_produced.try { strftime("%m/%d/%Y") } } }
.logo
= image_tag 'cdx-logo-bw.png'
.label https://cdx.io
Expand Down
3 changes: 2 additions & 1 deletion app/views/samples/_form.haml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@
.row
.col
= f.form_field :date_produced do
= f.date_field :date_produced, readonly: !@can_update
- @sample_form.blinded_attribute(:date_produced) do
= f.date_field :date_produced, readonly: !@can_update

= f.form_field :lab_technician do
= f.text_field :lab_technician, :class => 'input-x-large', readonly: !@can_update
Expand Down

0 comments on commit e4b2505

Please sign in to comment.