Skip to content

Commit

Permalink
Merge branch 'release/14.1' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
openprojectci committed Jun 1, 2024
2 parents 4e5b6f6 + 0541e03 commit c978859
Show file tree
Hide file tree
Showing 6 changed files with 84 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ You can adjust the following:

3. **Use current date as start date for new work packages**. This way the current date will always be set as a start date if your create new work packages. Also, if you copy projects, the new work packages will get the current date as start date.

4. **Progress calculation** lets you pick between two modes for how the **%&nsbp;Complete** field is calculated for work packages.
4. **Progress calculation** lets you pick between two modes for how the **% Complete** field is calculated for work packages.
- **Work-based**: % Complete is automatically calculated based on Work and Remaining work values for that work package, both of which are then necessary to have a value for % Complete.
- **Status-based**: you will have to define fixed % Complete values for each [work package status](../work-package-status), which will update automatically when team members update the status of their work packages.

5. **Default highlighting mode** (Enterprise add-on) defines which should be the default [attribute highlighting](../../../user-guide/work-packages/work-package-table-configuration/#attribute-highlighting-enterprise-add-on) mode, e.g. to highlight the following criteria in the work package table. This setting is only available for Enterprise on-premises and Enterprise cloud users.

![default highlighting mode](openproject_system_guide_default_highlighting_mode.png)

6. Customize the appearance of the work package tables to **define which work package attributes are displayed in the work package tables by default**.
6. Customize the appearance of the work package lists to **define which work package attributes are displayed in the work package lists by default and in what order**.

Do not forget to save your changes with the blue **Save** button at the bottom.

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 1 addition & 6 deletions docs/user-guide/work-packages/work-packages-faq/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,7 @@ You can set the assignee filter in the work package table to "Assignee and belon

### How can I track the progress of my work package?

You can track the progress either manually by changing the progress
bar in the work package details yourself. Or you can track it
automatically by assigning the progress in % to each status of
a work package. Please find the guide on how to do the automatic
tracking (in bullet point 5)
[here](../../../system-admin-guide/manage-work-packages/work-package-settings).
Progress of a work package is demonstrated by the value of **% Complete**. This is calculated either based on the status of the work package or on the values of *Work* and *Remaining work*. Please read more on progress reporting [here](../../time-and-costs/progress-tracking/#progress-reporting-modes).

### How can I track the progress of work packages with children?

Expand Down
18 changes: 15 additions & 3 deletions lib/api/v3/projects/project_eager_loading_wrapper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,15 @@ class ProjectEagerLoadingWrapper < API::V3::Utilities::EagerLoading::EagerLoadin

class << self
def wrap(projects)
custom_fields = projects.first.available_custom_fields if projects.present?
ancestors = ancestor_projects(projects) if projects.present?
if projects.present?
custom_fields_by_project_id = custom_fields_from_projects

ancestors = ancestor_projects(projects)
end

super
.each do |project|
project.available_custom_fields = custom_fields
project.available_custom_fields = custom_fields_by_project_id[project.id]
project.ancestors_from_root = ancestors.select { |a| a.is_ancestor_of?(project) }.sort_by(&:lft)
end
end
Expand All @@ -59,6 +62,15 @@ def ancestor_project_select(project)

projects_table[:lft].lt(project.lft).and(projects_table[:rgt].gt(project.rgt))
end

def custom_fields_from_projects
ProjectCustomFieldProjectMapping
.eager_load(:project_custom_field)
.merge(ProjectCustomField.visible)
.each_with_object(Hash.new { |h, k| h[k] = [] }) do |mapping, acc|
acc[mapping.project_id] << mapping.project_custom_field
end
end
end
end
end
Expand Down
64 changes: 64 additions & 0 deletions spec/lib/api/v3/projects/project_eager_loading_wrapper_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2012-2024 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-2013 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 COPYRIGHT and LICENSE files for more details.
#++

require "spec_helper"

RSpec.describe API::V3::Projects::ProjectEagerLoadingWrapper do
shared_let(:projects) { create_list(:project, 3) }

describe ".wrap" do
subject(:loaded_projects) { described_class.wrap(projects) }

it "returns wrapped projects with relations eager loaded" do
expect(loaded_projects.size).to eq(projects.size)
association_names = %i[@available_custom_fields @ancestors_from_root]
loaded_projects.each do |loaded_project|
association_names.each do |association|
expect(loaded_project.__getobj__.instance_variables).to include(association)
end
end
end

context "with available custom fields" do
let!(:text_project_custom_field) do
create :text_project_custom_field, projects: [projects.second, projects.third]
end

let!(:string_project_custom_field) do
create :string_project_custom_field, projects: [projects.third]
end

it "returns available custom fields for each project separately" do
expect(loaded_projects.first.available_custom_fields).to eq([])
expect(loaded_projects.second.available_custom_fields).to eq([text_project_custom_field])
expect(loaded_projects.third.available_custom_fields)
.to eq([text_project_custom_field, string_project_custom_field])
end
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
require "spec_helper"
require "rack/test"

RSpec.describe "API v3 members available projects resource" do
RSpec.describe "API v3 versions available projects resource" do
include Rack::Test::Methods
include API::V3::Utilities::PathHelper

Expand Down Expand Up @@ -78,7 +78,7 @@

subject(:response) { last_response }

describe "GET api/v3/members/available_projects" do
describe "GET api/v3/versions/available_projects" do
let(:projects) { [manage_project, view_project, unauthorized_project] }
let(:path) { api_v3_paths.versions_available_projects }

Expand Down

0 comments on commit c978859

Please sign in to comment.