lib/gooddata/models/metadata/report_definition.rb in gooddata-0.6.14 vs lib/gooddata/models/metadata/report_definition.rb in gooddata-0.6.15

- old
+ new

@@ -314,30 +314,30 @@ uri_what = what.respond_to?(:uri) ? what.uri : what uri_for_what = for_what.respond_to?(:uri) ? for_what.uri : for_what content['grid']['metrics'] = metric_parts.map do |item| item.deep_dup.tap do |i| - i['uri'].gsub!(uri_what, uri_for_what) + i['uri'].gsub!("[#{uri_what}]", "[#{uri_for_what}]") end end cols = content['grid']['columns'] || [] content['grid']['columns'] = cols.map do |item| if item.is_a?(Hash) item.deep_dup.tap do |i| - i['attribute']['uri'].gsub!(uri_what, uri_for_what) + i['attribute']['uri'].gsub!("[#{uri_what}]", "[#{uri_for_what}]") end else item end end rows = content['grid']['rows'] || [] content['grid']['rows'] = rows.map do |item| if item.is_a?(Hash) item.deep_dup.tap do |i| - i['attribute']['uri'].gsub!(uri_what, uri_for_what) + i['attribute']['uri'].gsub!("[#{uri_what}]", "[#{uri_for_what}]") end else item end end @@ -345,11 +345,11 @@ widths = content['grid']['columnWidths'] || [] content['grid']['columnWidths'] = widths.map do |item| if item.is_a?(Hash) item.deep_dup.tap do |i| if i['locator'][0].key?('attributeHeaderLocator') - i['locator'][0]['attributeHeaderLocator']['uri'].gsub!(uri_what, uri_for_what) + i['locator'][0]['attributeHeaderLocator']['uri'].gsub!("[#{uri_what}]", "[#{uri_for_what}]") end end else item end @@ -360,32 +360,31 @@ if item.is_a?(Hash) item.deep_dup.tap do |i| next unless i.key?('metricSort') next unless i['metricSort'].key?('locators') next unless i['metricSort']['locators'][0].key?('attributeLocator2') - i['metricSort']['locators'][0]['attributeLocator2']['uri'].gsub!(uri_what, uri_for_what) - i['metricSort']['locators'][0]['attributeLocator2']['element'].gsub!(uri_what, uri_for_what) + i['metricSort']['locators'][0]['attributeLocator2']['uri'].gsub!("[#{uri_what}]", "[#{uri_for_what}]") + i['metricSort']['locators'][0]['attributeLocator2']['element'].gsub!("[#{uri_what}]", "[#{uri_for_what}]") end else item end end if content.key?('chart') content['chart']['buckets'] = content['chart']['buckets'].reduce({}) do |a, e| key = e[0] val = e[1] - # binding.pry a[key] = val.map do |item| item.deep_dup.tap do |i| - i['uri'].gsub!(uri_what, uri_for_what) + i['uri'].gsub!("[#{uri_what}]", "[#{uri_for_what}]") end end a end end - content['filters'] = filters.map { |filter_expression| { 'expression' => filter_expression.gsub(uri_what, uri_for_what) } } + content['filters'] = filters.map { |filter_expression| { 'expression' => filter_expression.gsub("[#{uri_what}]", "[#{uri_for_what}]") } } end self end # Return true if the report definition is a table