Skip to content

Commit

Permalink
Merge pull request #15300 from opf/bug/54308-rounding-should-be-consi…
Browse files Browse the repository at this point in the history
…stent-on-progress-modal

[54308] Make rounding consistent with 2 decimals in progress modal
  • Loading branch information
cbliard authored Apr 18, 2024
2 parents c13dde4 + 479cb7c commit fb293ea
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ import { HalEventsService } from 'core-app/features/hal/services/hal-events.serv
import { WorkPackageResource } from 'core-app/features/hal/resources/work-package-resource';
import { ToastService } from 'core-app/shared/components/toaster/toast.service';
import { ApiV3Service } from 'core-app/core/apiv3/api-v3.service';
import * as moment from 'moment/moment';
import { TimezoneService } from 'core-app/core/datetime/timezone.service';

@Component({
Expand Down Expand Up @@ -137,7 +136,7 @@ export class ProgressPopoverEditFieldComponent extends ProgressEditFieldComponen
if (value === null) {
return '';
}
return moment.duration(value).asHours().toFixed(1);
return `${this.timezoneService.toHours(value)}`;
}

public statusFormatter(value:null|string):string {
Expand Down
8 changes: 4 additions & 4 deletions spec/features/work_packages/progress_modal_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -315,10 +315,10 @@ def update_work_package_with(work_package, attributes)

describe "field value format" do
context "with all values set" do
before { update_work_package_with(work_package, estimated_hours: 10.0, remaining_hours: 2.5) }
before { update_work_package_with(work_package, estimated_hours: 10.0, remaining_hours: 2.543) }

it "populates fields with correctly values formatted " \
"with the minimum fractional part if present" do
"with the minimum fractional part if present, and 2 decimals max" do
work_package_table.visit_query(progress_query)
work_package_table.expect_work_package_listed(work_package)

Expand All @@ -329,8 +329,8 @@ def update_work_package_with(work_package, attributes)
work_edit_field.activate!

work_edit_field.expect_modal_field_value("10")
remaining_work_edit_field.expect_modal_field_value("2.5")
percent_complete_edit_field.expect_modal_field_value("75", readonly: true)
remaining_work_edit_field.expect_modal_field_value("2.54")
percent_complete_edit_field.expect_modal_field_value("74", readonly: true)
end
end

Expand Down

0 comments on commit fb293ea

Please sign in to comment.