From 0e14420193d400ae6223d8e03114df75b368ac04 Mon Sep 17 00:00:00 2001 From: Mojca Lorber Date: Wed, 6 Sep 2017 14:41:14 +0200 Subject: [PATCH] fix bugs with importing samples --- app/models/team.rb | 4 ++-- app/views/samples/_parse_samples_modal.html.erb | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/models/team.rb b/app/models/team.rb index 72164fcf9..04a45375a 100644 --- a/app/models/team.rb +++ b/app/models/team.rb @@ -106,7 +106,7 @@ class Team < ActiveRecord::Base sheet.row(i).each.with_index do |value, index| if index == stype_index - stype = SampleType.where(name: value, team: self).take + stype = SampleType.where(name: value.strip, team: self).take unless stype stype = SampleType.new(name: value, team: self) @@ -117,7 +117,7 @@ class Team < ActiveRecord::Base end sample.sample_type = stype elsif index == sgroup_index - sgroup = SampleGroup.where(name: value, team: self).take + sgroup = SampleGroup.where(name: value.strip, team: self).take unless sgroup sgroup = SampleGroup.new(name: value, team: self) diff --git a/app/views/samples/_parse_samples_modal.html.erb b/app/views/samples/_parse_samples_modal.html.erb index 613c3d444..3e48a3f3c 100644 --- a/app/views/samples/_parse_samples_modal.html.erb +++ b/app/views/samples/_parse_samples_modal.html.erb @@ -28,7 +28,7 @@ <% if th.nil? %> <%= t('samples.modal_import.no_header_name') %> <% else %> - <% if th.length > Constants::NAME_TRUNCATION_LENGTH_DROPDOWN %> + <% if th.to_s.length > Constants::NAME_TRUNCATION_LENGTH_DROPDOWN %>