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
Display unset % Complete correctly
Christophe Bliard9a7bb0e7b13b
diff --git a/frontend/src/app/shared/components/fields/display/field-types/compound-progress-display-field.module.ts b/frontend/src/app/shared/components/fields/display/field-types/compound-progress-display-field.module.tsindex 644713f43d3..c5025d688f1 100644--- a/frontend/src/app/shared/components/fields/display/field-types/compound-progress-display-field.module.ts+++ b/frontend/src/app/shared/components/fields/display/field-types/compound-progress-display-field.module.ts@@ -86,8 +86,8 @@ export class CompoundProgressDisplayField extends DisplayField {element.appendChild(span);}- public get value():number {- return this.resource[this.name] as number || 0;+ public get value():number|null {+ return this.resource[this.name] as number|null;}public get valueString() {@@ -98,15 +98,18 @@ export class CompoundProgressDisplayField extends DisplayField {return `derived${_.upperFirst(this.name)}`;}- private get derivedValue() {- return this.resource[this.derivedPropertyName] as number;+ private get derivedValue():number|null {+ return this.resource[this.derivedPropertyName] as number|null;}private get derivedValueString():string {return this.formatAsPercentage(this.derivedValue);}- private formatAsPercentage(value:number) {+ private formatAsPercentage(value:number|null) {+ if (value === null) {+ return this.placeholder;+ }return `${value}%`;}diff --git a/frontend/src/app/shared/components/fields/display/field-types/progress-display-field.module.ts b/frontend/src/app/shared/components/fields/display/field-types/progress-display-field.module.tsdeleted file mode 100644index 657e10a61db..00000000000--- a/frontend/src/app/shared/components/fields/display/field-types/progress-display-field.module.ts+++ /dev/null@@ -1,59 +0,0 @@-// -- 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.-//++--import { DisplayField } from 'core-app/shared/components/fields/display/display-field.module';--export class ProgressDisplayField extends DisplayField {- public get value() {- if (this.schema) {- return this.resource[this.name] || 0;- }- return null;- }-- public get percentLabel() {- return `${this.roundedProgress}%`;- }-- public get roundedProgress() {- return Math.round(Number(this.value)) || 0;- }-- public render(element:HTMLElement, displayText:string):void {- element.setAttribute('title', displayText);- element.innerHTML = `- <span>- <span style="width: 80px" class="progress-bar">- <span style="width: ${this.roundedProgress}%" class="inner-progress closed"></span>- <span style="width: 0%" class="inner-progress done"></span>- </span>- <span class="progress-bar-legend">${this.percentLabel}</span>- </span>- `;- }-}diff --git a/frontend/src/app/shared/components/fields/display/field-types/progress-text-display-field.module.ts b/frontend/src/app/shared/components/fields/display/field-types/progress-text-display-field.module.tsindex e70e6e0a24a..031e148367d 100644--- a/frontend/src/app/shared/components/fields/display/field-types/progress-text-display-field.module.ts+++ b/frontend/src/app/shared/components/fields/display/field-types/progress-text-display-field.module.ts@@ -26,13 +26,10 @@// See COPYRIGHT and LICENSE files for more details.//++-import { ProgressDisplayField } from './progress-display-field.module';+import { DisplayField } from 'core-app/shared/components/fields/display/display-field.module';-export class ProgressTextDisplayField extends ProgressDisplayField {- public render(element:HTMLElement, displayText:string):void {- const label = this.percentLabel;- element.setAttribute('title', label);- element.innerHTML = '';- element.textContent = label;+export class ProgressTextDisplayField extends DisplayField {+ public get valueString() {+ return `${Math.round(Number(this.value))}%`;}}