OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
remove module only applied in production mode
ulfertsab658220d569
diff --git a/modules/reporting/app/models/cost_query/query_utils.rb b/modules/reporting/app/models/cost_query/query_utils.rbdeleted file mode 100644index 583db9dbf01..00000000000--- a/modules/reporting/app/models/cost_query/query_utils.rb+++ /dev/null@@ -1,61 +0,0 @@-#-- copyright-# OpenProject is an open source project management software.-# Copyright (C) 2012-2020 the OpenProject GmbH-#-# This program is free software; you can redistribute it and/or-# modify it under the terms of the GNU General Public License version 3.-#-# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:-# Copyright (C) 2006-2017 Jean-Philippe Lang-# Copyright (C) 2010-2013 the ChiliProject Team-#-# This program is free software; you can redistribute it and/or-# modify it under the terms of the GNU General Public License-# as published by the Free Software Foundation; either version 2-# of the License, or (at your option) any later version.-#-# This program is distributed in the hope that it will be useful,-# but WITHOUT ANY WARRANTY; without even the implied warranty of-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the-# GNU General Public License for more details.-#-# You should have received a copy of the GNU General Public License-# along with this program; if not, write to the Free Software-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.-#-# See docs/COPYRIGHT.rdoc for more details.-#++--module CostQuery::QueryUtils- include Redmine::I18n- include Report::QueryUtils-- def map_field(key, value)- case key.to_s- when "user_id" then value ? user_name(value.to_i) : ''- when "tweek", "tyear", "tmonth", /_id$/ then value.to_i- when "week" then value.to_i.divmod(100)- when /_(on|at)$/ then value ? value.to_dateish : Time.at(0)- when /^custom_field/ then value.to_s- when "singleton_value" then value.to_i- else super- end- end-- def user_name(id)- # we have no identity map... :(- cache[:user_name][id] ||= User.find(id).name- end-- ##- # Graceful, internationalized quoted string.- #- # @see quote_string- # @param [Object] str String to quote/translate- # @return [Object] Quoted, translated version- def quoted_label(ident)- "'#{quote_string l(ident)}'"- end-- propagate!-enddiff --git a/modules/reporting_engine/lib/report/query_utils.rb b/modules/reporting_engine/lib/report/query_utils.rbindex 85f45ca490a..09f482f1fdd 100644--- a/modules/reporting_engine/lib/report/query_utils.rb+++ b/modules/reporting_engine/lib/report/query_utils.rb@@ -30,35 +30,11 @@ module Report::QueryUtilsInfinity = 1.0 / 0include Engine- alias singleton_class metaclass unless respond_to? :singleton_class-delegate :quoted_false, :quoted_true, to: 'engine.reporting_connection'attr_writer :engineinclude Costs::NumberHelper- module PropagationHook- include Report::QueryUtils-- def append_features(base)- ancestors[1..-1].reverse_each { |m| base.send(:include, m) }- base.extend PropagationHook- base.extend self- super- end-- def propagate!(to = engine)- to.constants(false).each do |name|- const = to.const_get name- next unless Module === const- append_features const unless const <= self or not const < Report::QueryUtils- propagate! const- end- end- end-- extend PropagationHook-### Graceful string quoting.#@@ -193,36 +169,20 @@ module Report::QueryUtils# Converts value with a given behavior, but treats nil differently.# Params# - value: the value to convert- # - weight_of_nil (optional): How a nil should be treated.- # :infinit - makes a nil weight really heavy, which will make it stay- # at the very end when sorting- # :negative_infinit - opposite of :infinit, let's the nil stay at the very beginning- # any other object - nil's will be replaced by thyt object# - block (optional) - defines how to convert values which are not nil# if no block is given, values stay untouched- def convert_unless_nil(value, weight_of_nil = :infinit)+ def convert_unless_nil(value)if value.nil?- if weight_of_nil == :infinit- 1.0 / 0 # Infinity, which is greater than any string or number- elsif weight_of_nil == :negative_infinit- -1.0 / 0 # negative Infinity, which is smaller than any string or number- else- weight_of_nil- end+ 1.0 / 0 # Infinity, which is greater than any string or numberelse- if block_given?- yield value- else- value- end+ yield valueendenddef map_field(key, value)case key.to_s- when 'singleton_value', /_id$/ then convert_unless_nil(value) { |v| v.to_i }- when 'work_package_id', 'tweek', 'tmonth', 'tweek' then value.to_i- else convert_unless_nil(value) { |v| v.to_s }+ when 'tweek', 'tmonth', 'tweek' then value.to_i+ else convert_unless_nil(value, &:to_s)endenddiff --git a/modules/reporting_engine/lib/report/table.rb b/modules/reporting_engine/lib/report/table.rbindex ebbe0c5261e..0a7f69ad489 100644--- a/modules/reporting_engine/lib/report/table.rb+++ b/modules/reporting_engine/lib/report/table.rb@@ -27,7 +27,6 @@#++# encoding: UTF-8-require 'enumerator'class Report::Tableattr_accessor :querydiff --git a/modules/reporting_engine/lib/widget/base.rb b/modules/reporting_engine/lib/widget/base.rbindex 6e52cba20a0..c6674537c5d 100644--- a/modules/reporting_engine/lib/widget/base.rb+++ b/modules/reporting_engine/lib/widget/base.rb@@ -68,7 +68,7 @@ module ::Widget### Render this widget. Abstract method. Needs to call #write at least oncedef render- raise NotImplementedError, "#render is missing in my subclass #{self.class}"+ raise NotImplementedError, "#render is missing in my subclass #{self.class}"end##