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

Blinding date_produced for samples and keeping samples order for send… #2001

Merged
merged 3 commits into from
Apr 19, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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 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.date_produced == "Blinded" ? "Blinded" : 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.date_produced == "Blinded" ? "Blinded" : 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 ? @sample_form.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
Loading