Skip to content

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

[37157] Fix float value rendering with zero value (#9255)

Oliver Günther76c828d8d599
diff --git a/frontend/src/app/modules/fields/field.base.ts b/frontend/src/app/modules/fields/field.base.ts
index 97732fdf741..b7f2bbe9ea5 100644
--- a/frontend/src/app/modules/fields/field.base.ts
+++ b/frontend/src/app/modules/fields/field.base.ts
@@ -75,7 +75,7 @@ export class Field extends UntilDestroyedMixin {
}
public isEmpty():boolean {
- return !this.value;
+ return this.value === undefined || this.value === null || this.value === '';
}
public get unknownAttribute():boolean {
diff --git a/spec/features/work_packages/details/custom_fields/custom_field_spec.rb b/spec/features/work_packages/details/custom_fields/custom_field_spec.rb
index 8bd80840a2a..cc2ce5c06ab 100644
--- a/spec/features/work_packages/details/custom_fields/custom_field_spec.rb
+++ b/spec/features/work_packages/details/custom_fields/custom_field_spec.rb
@@ -198,6 +198,15 @@ describe 'custom field inplace editor', js: true do
let(:args) { {} }
let(:initial_custom_values) { { custom_field.id => 123.50 } }
+ context 'with zero value' do
+ let(:user) { FactoryBot.create :admin, language: 'en' }
+ let(:initial_custom_values) { { custom_field.id => 0 } }
+
+ it 'displays the zero (Regression #37157)' do
+ field.expect_state_text '0'
+ end
+ end
+
context 'with english locale' do
let(:user) { FactoryBot.create :admin, language: 'en' }