From f09f6d84206b5cbf65dbb036842ee1dc06ba34b3 Mon Sep 17 00:00:00 2001 From: PiTrem Date: Tue, 18 Feb 2025 10:39:56 +0100 Subject: [PATCH 1/2] fix: sample attribute assignment wrongly rm by cop since: 2f8ad4f67 Sample attribute name not recognized and tagged as `Useless assignement to variable` rm in style: rubocop app/models/sample.rb (#2325) refs: #2325 --- app/models/sample.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/sample.rb b/app/models/sample.rb index 87b4b0ae0d..acae7e0539 100644 --- a/app/models/sample.rb +++ b/app/models/sample.rb @@ -445,7 +445,7 @@ def find_or_create_molecule_based_on_inchikey return if inchikey.blank? is_partial = babel_info[:is_partial] - babel_info[:version] + molfile_version = babel_info[:version] return unless molecule&.inchikey != inchikey || molecule.is_partial != is_partial self.molecule = Molecule.find_or_create_by_molfile(molfile, babel_info) From 0d4a3963359b0474a42de6f51fe983bf35f6dd41 Mon Sep 17 00:00:00 2001 From: PiTrem Date: Thu, 20 Feb 2025 12:06:46 +0100 Subject: [PATCH 2/2] ensure attribute is set with self --- app/models/sample.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/sample.rb b/app/models/sample.rb index acae7e0539..844e02b7fa 100644 --- a/app/models/sample.rb +++ b/app/models/sample.rb @@ -445,7 +445,7 @@ def find_or_create_molecule_based_on_inchikey return if inchikey.blank? is_partial = babel_info[:is_partial] - molfile_version = babel_info[:version] + self.molfile_version = babel_info[:version] return unless molecule&.inchikey != inchikey || molecule.is_partial != is_partial self.molecule = Molecule.find_or_create_by_molfile(molfile, babel_info)