Project

General

Profile

Feature #42663 ยป optimize-gantt-rendering.patch

Go MAEDA, 2025-05-03 10:55

View differences:

lib/redmine/helpers/gantt.rb
# Returns the distinct versions of the issues that belong to +project+
def project_versions(project)
project_issues(project).filter_map(&:fixed_version).uniq
@project_versions ||= {}
@project_versions[project&.id] ||= begin
ids = project_issues(project).filter_map(&:fixed_version_id).uniq
Version.where(id: ids).to_a
end
end
# Returns the issues that belong to +project+ and are assigned to +version+
def version_issues(project, version)
project_issues(project).select {|issue| issue.fixed_version == version}
@version_issues ||= {}
@version_issues[[project&.id, version&.id]] ||=
project_issues(project).select {|issue| issue.fixed_version_id == version&.id}
end
def render(options={})
......
render_object_row(project, options)
increment_indent(options) do
# render issue that are not assigned to a version
issues = project_issues(project).select {|i| i.fixed_version.nil?}
issues = project_issues(project).select {|i| i.fixed_version_id.nil?}
render_issues(issues, options)
# then render project versions and their issues
versions = project_versions(project)
......
tag_options[:id] = "issue-#{object.id}"
tag_options[:class] = "issue-subject hascontextmenu"
tag_options[:title] = object.subject
children = object.leaf? ? [] : object.children & project_issues(object.project)
has_children =
children.present? &&
children.collect(&:fixed_version).uniq.intersect?([object.fixed_version])
!object.leaf? &&
object.children.any? do |child|
child.fixed_version_id == object.fixed_version_id &&
child.project_id == object.project_id
end
when Version
tag_options[:id] = "version-#{object.id}"
tag_options[:class] = "version-name"
    (1-1/1)