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 new fields for samples on blind box creation #1978

Merged
merged 2 commits into from
Jul 27, 2023
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
5 changes: 5 additions & 0 deletions app/assets/stylesheets/_forms.scss
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@ label {
padding-top: 10px;
}
}

.blinded {
line-height: 2.6em;
}

.blinded, .blinded i {
color: $gray2;
}
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 reference_gene target_organism_taxonomy_id pango_lineage who_label]
end

# Returns true if a sample attribute should be blinded for the current box.
Expand Down
12 changes: 8 additions & 4 deletions app/views/samples/_form.haml
Original file line number Diff line number Diff line change
Expand Up @@ -66,16 +66,20 @@
.span.unit (μl)

= f.form_field :reference_gene do
= autocomplete_field(f, "sample[reference_gene]", :reference_gene, @navigation_context.institution, class: "input-x-large")
- @sample_form.blinded_attribute(:reference_gene) do
= autocomplete_field(f, "sample[reference_gene]", :reference_gene, @navigation_context.institution, class: "input-x-large")

= f.form_field :target_organism_taxonomy_id do
= autocomplete_field(f, "sample[target_organism_taxonomy_id]", :target_organism_taxonomy_id, @navigation_context.institution, class: "input-x-large")
- @sample_form.blinded_attribute(:target_organism_taxonomy_id) do
= autocomplete_field(f, "sample[target_organism_taxonomy_id]", :target_organism_taxonomy_id, @navigation_context.institution, class: "input-x-large")

= f.form_field :pango_lineage do
= autocomplete_field(f, "sample[pango_lineage]", :pango_lineage, @navigation_context.institution, class: "input-x-large")
- @sample_form.blinded_attribute(:pango_lineage) do
= autocomplete_field(f, "sample[pango_lineage]", :pango_lineage, @navigation_context.institution, class: "input-x-large")

= f.form_field :who_label do
= autocomplete_field(f, "sample[who_label]", :who_label, @navigation_context.institution, class: "input-x-large")
- @sample_form.blinded_attribute(:who_label) do
= autocomplete_field(f, "sample[who_label]", :who_label, @navigation_context.institution, class: "input-x-large")

= f.form_field :concentration do
- @sample_form.blinded_attribute(:concentration) do
Expand Down
4 changes: 4 additions & 0 deletions spec/controllers/samples_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,10 @@
assert_select "input[name='sample[replicate]']", count: 0
assert_select "input[name='sample[virus_lineage]']", count: 0
assert_select "input[name='sample[isolate_name]']", count: 0
assert_select "input[name='sample[reference_gene]']", count: 0
assert_select "input[name='sample[target_organism_taxonomy_id]']", count: 0
assert_select "input[name='sample[pango_lineage]']", count: 0
assert_select "input[name='sample[who_label]']", count: 0
end
end
end
Expand Down