All checks were successful
continuous-integration/drone/push Build is passing
244 lines
7.0 KiB
Diff
244 lines
7.0 KiB
Diff
--- a/plugins/redmine_workload/lib/redmine_workload.rb
|
|
+++ b/plugins/redmine_workload/lib/redmine_workload.rb
|
|
@@ -1,7 +1,7 @@
|
|
# frozen_string_literal: true
|
|
|
|
require_relative 'redmine_workload/extensions/user_patch'
|
|
-require_relative 'redmine_workload/hooks/plugin'
|
|
+require_relative 'redmine_workload/hooks/after_plugins_loaded_hook'
|
|
require_relative 'redmine_workload/group_workload_preparer'
|
|
require_relative 'redmine_workload/user_workload_preparer'
|
|
require_relative 'redmine_workload/wl_calculation_restrictions'
|
|
--- a/plugins/redmine_workload/lib/redmine_workload/group_workload_preparer.rb
|
|
+++ b/plugins/redmine_workload/lib/redmine_workload/group_workload_preparer.rb
|
|
@@ -1,5 +1,7 @@
|
|
# frozen_string_literal: true
|
|
|
|
+module RedmineWorkload
|
|
+
|
|
require 'forwardable'
|
|
|
|
class GroupWorkloadPreparer
|
|
@@ -44,3 +46,5 @@ class GroupWorkloadPreparer
|
|
|
|
attr_writer :data, :params
|
|
end
|
|
+
|
|
+end
|
|
\ No newline at end of file
|
|
--- a/plugins/redmine_workload/lib/redmine_workload/user_workload_preparer.rb
|
|
+++ b/plugins/redmine_workload/lib/redmine_workload/user_workload_preparer.rb
|
|
@@ -1,5 +1,7 @@
|
|
# frozen_string_literal: true
|
|
|
|
+module RedmineWorkload
|
|
+
|
|
require 'forwardable'
|
|
|
|
class UserWorkloadPreparer
|
|
@@ -36,3 +38,5 @@ class UserWorkloadPreparer
|
|
|
|
attr_writer :data, :params
|
|
end
|
|
+
|
|
+end
|
|
\ No newline at end of file
|
|
--- a/plugins/redmine_workload/lib/redmine_workload/wl_calculation_restrictions.rb
|
|
+++ b/plugins/redmine_workload/lib/redmine_workload/wl_calculation_restrictions.rb
|
|
@@ -1,5 +1,7 @@
|
|
# frozen_string_literal: true
|
|
|
|
+module RedmineWorkload
|
|
+
|
|
module WlCalculationRestrictions
|
|
def consider_parent_issues?
|
|
settings['workload_of_parent_issues'].present?
|
|
@@ -9,3 +11,5 @@ module WlCalculationRestrictions
|
|
Setting.plugin_redmine_workload
|
|
end
|
|
end
|
|
+
|
|
+end
|
|
\ No newline at end of file
|
|
--- a/plugins/redmine_workload/lib/redmine_workload/wl_csv_exporter.rb
|
|
+++ b/plugins/redmine_workload/lib/redmine_workload/wl_csv_exporter.rb
|
|
@@ -1,5 +1,7 @@
|
|
# frozen_string_literal: true
|
|
|
|
+module RedmineWorkload
|
|
+
|
|
require 'forwardable'
|
|
|
|
class WlCsvExporter
|
|
@@ -106,3 +108,5 @@ class WlCsvExporter
|
|
data.time_span.map { |date| format_date(date) }
|
|
end
|
|
end
|
|
+
|
|
+end
|
|
\ No newline at end of file
|
|
--- a/plugins/redmine_workload/lib/redmine_workload/wl_date_tools.rb
|
|
+++ b/plugins/redmine_workload/lib/redmine_workload/wl_date_tools.rb
|
|
@@ -1,5 +1,7 @@
|
|
# frozen_string_literal: true
|
|
|
|
+module RedmineWorkload
|
|
+
|
|
require_relative 'wl_user_data_defaults'
|
|
|
|
class WlDateTools
|
|
@@ -85,3 +87,5 @@ class WlDateTools
|
|
!WlUserVacation.where('user_id = ? AND date_from <= ? AND date_to >= ?', assignee.id, day, day).empty?
|
|
end
|
|
end
|
|
+
|
|
+end
|
|
\ No newline at end of file
|
|
--- a/plugins/redmine_workload/lib/redmine_workload/wl_issue_query.rb
|
|
+++ b/plugins/redmine_workload/lib/redmine_workload/wl_issue_query.rb
|
|
@@ -1,5 +1,7 @@
|
|
# frozen_string_literal: true
|
|
|
|
+module RedmineWorkload
|
|
+
|
|
module WlIssueQuery
|
|
include WlCalculationRestrictions
|
|
##
|
|
@@ -38,3 +40,5 @@ module WlIssueQuery
|
|
issues.split.flatten
|
|
end
|
|
end
|
|
+
|
|
+end
|
|
\ No newline at end of file
|
|
--- a/plugins/redmine_workload/lib/redmine_workload/wl_issue_state.rb
|
|
+++ b/plugins/redmine_workload/lib/redmine_workload/wl_issue_state.rb
|
|
@@ -1,5 +1,7 @@
|
|
# frozen_string_literal: true
|
|
|
|
+module RedmineWorkload
|
|
+
|
|
module WlIssueState
|
|
##
|
|
# Redefines the overdue state of an issue. Instead of comparing issue.due_date
|
|
@@ -10,3 +12,5 @@ module WlIssueState
|
|
issue.due_date.present? && (issue.due_date < date) && !issue.closed?
|
|
end
|
|
end
|
|
+
|
|
+end
|
|
\ No newline at end of file
|
|
--- a/plugins/redmine_workload/lib/redmine_workload/wl_user_data_defaults.rb
|
|
+++ b/plugins/redmine_workload/lib/redmine_workload/wl_user_data_defaults.rb
|
|
@@ -1,5 +1,7 @@
|
|
# frozen_string_literal: true
|
|
|
|
+module RedmineWorkload
|
|
+
|
|
##
|
|
# Provides the default values for WlUserData object
|
|
#
|
|
@@ -14,3 +16,5 @@ module WlUserDataDefaults
|
|
Setting['plugin_redmine_workload']
|
|
end
|
|
end
|
|
+
|
|
+end
|
|
\ No newline at end of file
|
|
--- a/plugins/redmine_workload/lib/redmine_workload/wl_user_data_finder.rb
|
|
+++ b/plugins/redmine_workload/lib/redmine_workload/wl_user_data_finder.rb
|
|
@@ -1,5 +1,7 @@
|
|
# frozen_string_literal: true
|
|
|
|
+module RedmineWorkload
|
|
+
|
|
##
|
|
# Finder method for WLUserData
|
|
#
|
|
@@ -14,3 +16,5 @@ module WlUserDataFinder
|
|
@user_workload_data
|
|
end
|
|
end
|
|
+
|
|
+end
|
|
\ No newline at end of file
|
|
--- a/plugins/redmine_workload/app/controllers/wl_national_holiday_controller.rb
|
|
+++ b/plugins/redmine_workload/app/controllers/wl_national_holiday_controller.rb
|
|
@@ -3,7 +3,7 @@
|
|
require 'json'
|
|
|
|
class WlNationalHolidayController < ApplicationController
|
|
- include WlUserDataFinder
|
|
+ include RedmineWorkload::WlUserDataFinder
|
|
|
|
before_action :authorize_global, only: %i[create update destroy]
|
|
before_action :find_user_workload_data
|
|
--- a/plugins/redmine_workload/app/controllers/wl_user_datas_controller.rb
|
|
+++ b/plugins/redmine_workload/app/controllers/wl_user_datas_controller.rb
|
|
@@ -1,7 +1,7 @@
|
|
# frozen_string_literal: true
|
|
|
|
class WlUserDatasController < ApplicationController
|
|
- include WlUserDataFinder
|
|
+ include RedmineWorkload::WlUserDataFinder
|
|
|
|
helper :workloads
|
|
helper :wl_user_datas
|
|
--- a/plugins/redmine_workload/app/controllers/wl_user_vacations_controller.rb
|
|
+++ b/plugins/redmine_workload/app/controllers/wl_user_vacations_controller.rb
|
|
@@ -1,7 +1,7 @@
|
|
# frozen_string_literal: true
|
|
|
|
class WlUserVacationsController < ApplicationController
|
|
- include WlUserDataFinder
|
|
+ include RedmineWorkload::WlUserDataFinder
|
|
|
|
helper :workloads
|
|
|
|
--- a/plugins/redmine_workload/app/controllers/workloads_controller.rb
|
|
+++ b/plugins/redmine_workload/app/controllers/workloads_controller.rb
|
|
@@ -11,7 +11,7 @@ class WorkloadsController < ApplicationController
|
|
helper :workloads
|
|
|
|
include QueriesHelper
|
|
- include WlUserDataFinder
|
|
+ include RedmineWorkload::WlUserDataFinder
|
|
include WorkloadsHelper
|
|
|
|
before_action :authorize_global, only: %i[index]
|
|
--- a/plugins/redmine_workload/app/models/user_workload.rb
|
|
+++ b/plugins/redmine_workload/app/models/user_workload.rb
|
|
@@ -6,8 +6,8 @@
|
|
#
|
|
class UserWorkload
|
|
include Redmine::I18n
|
|
- include WlIssueQuery
|
|
- include WlIssueState
|
|
+ include RedmineWorkload::WlIssueQuery
|
|
+ include RedmineWorkload::WlIssueState
|
|
|
|
attr_reader :assignees, :issues, :time_span, :today
|
|
|
|
--- a/plugins/redmine_workload/app/models/wl_default_user_data.rb
|
|
+++ b/plugins/redmine_workload/app/models/wl_default_user_data.rb
|
|
@@ -4,7 +4,7 @@
|
|
# Holds default user related data for workload calculation.
|
|
#
|
|
class WlDefaultUserData
|
|
- include WlUserDataDefaults
|
|
+ include RedmineWorkload::WlUserDataDefaults
|
|
|
|
def threshold_lowload_min
|
|
default_attributes[:threshold_lowload_min].to_f
|
|
--- a/plugins/redmine_workload/app/models/wl_user_data.rb
|
|
+++ b/plugins/redmine_workload/app/models/wl_user_data.rb
|
|
@@ -4,7 +4,7 @@
|
|
# Holds user related data for workload calculation.
|
|
#
|
|
class WlUserData < ActiveRecord::Base
|
|
- include WlUserDataDefaults
|
|
+ include RedmineWorkload::WlUserDataDefaults
|
|
|
|
belongs_to :user, inverse_of: :wl_user_data, optional: true
|
|
self.table_name = 'wl_user_datas'
|