Project

General

Profile

Bug #29203

Repository sync in tasks page shows percentage in 17 decimal points

Added by Adam Ruzicka about 1 month ago. Updated about 1 month ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
-
Target version:
-
Difficulty:
Triaged:
No
Bugzilla link:
Fixed in Releases:
Found in Releases:

Description

Description of problem:
When we sync a repository and see the task status in the Monitor -> Tasks page, the percentage is not rounded off rather it shows up to 17 decimal points like "0.44999999999999996% Complete"

How reproducible:

Always
Steps to Reproduce:
1. Sync a larger repository (so that the sync doesn't complete quickly)
2. Go to Monitor -> Tasks page and select the repo sync tasks
3. Observe the increase in percent, it says 0.44999999999999996% Complete

Actual results:
Repo Sync tasks show % completion in up to 17 decimal points

Expected results:
It should be rounded to 2 digit.


Related issues

Related to foreman-tasks - Bug #27991: Excessive precision displayed in task progressClosed

Associated revisions

Revision 0eb1e2ed (diff)
Added by Adam Ruzicka about 1 month ago

Fixes #29203 - Fix an edge case with excessive progress precision

Before this patch we took a float in the range from 0 to 1, turned it into a
string with desired precision and then multiplied it with 100 to get the
percentage. However, this didn't really work for all inputs, because of the well
known issues when multiplying floats.

x = 0.004545454545454546

0.004545454545454546

x.toFixed(4) * 100

0.44999999999999996

parseFloat((x * 100).toFixed(2))

0.45

History

#1 Updated by Adam Ruzicka about 1 month ago

  • Related to Bug #27991: Excessive precision displayed in task progress added

#2 Updated by The Foreman Bot about 1 month ago

  • Assignee set to Adam Ruzicka
  • Status changed from New to Ready For Testing
  • Pull request https://github.com/theforeman/foreman-tasks/pull/512 added

#3 Updated by The Foreman Bot about 1 month ago

  • Fixed in Releases foreman-tasks-1.0.2 added

#4 Updated by Adam Ruzicka about 1 month ago

  • Status changed from Ready For Testing to Closed

Also available in: Atom PDF