Merge pull request #786 from mlorb/ml-sci-1587

Fix bugs with importing samples [SCI-1587]
This commit is contained in:
mlorb 2017-09-08 09:19:35 +02:00 committed by GitHub
commit 03743a21f6
2 changed files with 3 additions and 3 deletions

View file

@ -106,7 +106,7 @@ class Team < ActiveRecord::Base
sheet.row(i).each.with_index do |value, index| sheet.row(i).each.with_index do |value, index|
if index == stype_index if index == stype_index
stype = SampleType.where(name: value, team: self).take stype = SampleType.where(name: value.strip, team: self).take
unless stype unless stype
stype = SampleType.new(name: value, team: self) stype = SampleType.new(name: value, team: self)
@ -117,7 +117,7 @@ class Team < ActiveRecord::Base
end end
sample.sample_type = stype sample.sample_type = stype
elsif index == sgroup_index elsif index == sgroup_index
sgroup = SampleGroup.where(name: value, team: self).take sgroup = SampleGroup.where(name: value.strip, team: self).take
unless sgroup unless sgroup
sgroup = SampleGroup.new(name: value, team: self) sgroup = SampleGroup.new(name: value, team: self)

View file

@ -28,7 +28,7 @@
<% if th.nil? %> <% if th.nil? %>
<i><%= t('samples.modal_import.no_header_name') %></i> <i><%= t('samples.modal_import.no_header_name') %></i>
<% else %> <% else %>
<% if th.length > Constants::NAME_TRUNCATION_LENGTH_DROPDOWN %> <% if th.to_s.length > Constants::NAME_TRUNCATION_LENGTH_DROPDOWN %>
<div class="modal-tooltip"> <div class="modal-tooltip">
<%= truncate(th, length: Constants::NAME_TRUNCATION_LENGTH_DROPDOWN) %> <%= truncate(th, length: Constants::NAME_TRUNCATION_LENGTH_DROPDOWN) %>
</div> </div>