From d5c238d5e6ad459aae44ed2f85bd12382dbe6259 Mon Sep 17 00:00:00 2001 From: Imad Bourouche Date: Tue, 4 Mar 2025 15:26:42 +0100 Subject: [PATCH] fix tests --- .../semantic_artefact/attribute_fetcher.rb | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/ontologies_linked_data/concerns/semantic_artefact/attribute_fetcher.rb b/lib/ontologies_linked_data/concerns/semantic_artefact/attribute_fetcher.rb index d17b8fe6..0a6d18c4 100644 --- a/lib/ontologies_linked_data/concerns/semantic_artefact/attribute_fetcher.rb +++ b/lib/ontologies_linked_data/concerns/semantic_artefact/attribute_fetcher.rb @@ -10,7 +10,7 @@ def bring(*attributes) next unless mapping model = mapping[:model] mapped_attr = mapping[:attribute] - hash[model][mapped_attr] = attr + hash[model][attr] = mapped_attr end fetch_from_ontology(grouped_attributes[:ontology]) if grouped_attributes[:ontology].any? @@ -22,8 +22,8 @@ def bring(*attributes) def fetch_from_ontology(attributes) return if attributes.empty? - @ontology.bring(*attributes.keys) - attributes.each do |mapped_attr, attr| + @ontology.bring(*attributes.values) + attributes.each do |attr, mapped_attr| self.send("#{attr}=", @ontology.send(mapped_attr)) if @ontology.respond_to?(mapped_attr) end end @@ -32,8 +32,8 @@ def fetch_from_submission(attributes) return if attributes.empty? @latest ||= defined?(@ontology) ? @ontology.latest_submission(status: :ready) : @submission return unless @latest - @latest.bring(*attributes.keys) - attributes.each do |mapped_attr, attr| + @latest.bring(*attributes.values) + attributes.each do |attr, mapped_attr| self.send("#{attr}=", @latest.send(mapped_attr)) if @latest.respond_to?(mapped_attr) end end @@ -42,8 +42,8 @@ def fetch_from_metrics(attributes) return if attributes.empty? @latest ||= defined?(@ontology) ? @ontology.latest_submission(status: :ready) : @submission return unless @latest - @latest.bring(metrics: [attributes.keys]) - attributes.each do |mapped_attr, attr| + @latest.bring(metrics: [attributes.values]) + attributes.each do |attr, mapped_attr| metric_value = @latest.metrics&.respond_to?(mapped_attr) ? @latest.metrics.send(mapped_attr) || 0 : 0 self.send("#{attr}=", metric_value) end