diff --git a/app/controllers/boxes_controller.rb b/app/controllers/boxes_controller.rb index 8c03c58c6..750b7a148 100644 --- a/app/controllers/boxes_controller.rb +++ b/app/controllers/boxes_controller.rb @@ -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) diff --git a/app/documents/label_pdf.rb b/app/documents/label_pdf.rb index 6a0b7cc01..2ce6b81f1 100644 --- a/app/documents/label_pdf.rb +++ b/app/documents/label_pdf.rb @@ -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 diff --git a/app/models/box.rb b/app/models/box.rb index 8c62e8212..b784bbaf8 100644 --- a/app/models/box.rb +++ b/app/models/box.rb @@ -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. diff --git a/app/views/boxes/inventory.csv.csvbuilder b/app/views/boxes/inventory.csv.csvbuilder index 9813c239e..41fe65527 100644 --- a/app/views/boxes/inventory.csv.csvbuilder +++ b/app/views/boxes/inventory.csv.csvbuilder @@ -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, ] diff --git a/app/views/samples/_barcode_card.haml b/app/views/samples/_barcode_card.haml index 8ffd1e53e..7cdfd977a 100644 --- a/app/views/samples/_barcode_card.haml +++ b/app/views/samples/_barcode_card.haml @@ -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 diff --git a/app/views/samples/_form.haml b/app/views/samples/_form.haml index e63c1cf7e..af8775892 100644 --- a/app/views/samples/_form.haml +++ b/app/views/samples/_form.haml @@ -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