mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-10 00:42:41 +01:00
When summing points on a workboard, display sum with same precision as most-precise value
Summary: Fixes T11703. This mostly avoids rounding errors. If point values include "0.001", we also get three digits of precision: 1.000. Maybe useful if your point field is called "bitcoins" or something. Test Plan: Before: {F1851404} After: {F1851405} Reviewers: chad Reviewed By: chad Maniphest Tasks: T11703 Differential Revision: https://secure.phabricator.com/D16601
This commit is contained in:
parent
26b29a60c0
commit
f2bb9bc061
2 changed files with 17 additions and 6 deletions
|
@ -495,7 +495,7 @@ return array(
|
|||
'rsrc/js/application/policy/behavior-policy-rule-editor.js' => '5e9f347c',
|
||||
'rsrc/js/application/projects/WorkboardBoard.js' => 'fe7cb52a',
|
||||
'rsrc/js/application/projects/WorkboardCard.js' => 'c587b80f',
|
||||
'rsrc/js/application/projects/WorkboardColumn.js' => 'bae58312',
|
||||
'rsrc/js/application/projects/WorkboardColumn.js' => '21df4ff5',
|
||||
'rsrc/js/application/projects/WorkboardController.js' => '55baf5ed',
|
||||
'rsrc/js/application/projects/behavior-project-boards.js' => '14a1faae',
|
||||
'rsrc/js/application/projects/behavior-project-create.js' => '065227cc',
|
||||
|
@ -825,7 +825,7 @@ return array(
|
|||
'javelin-websocket' => 'e292eaf4',
|
||||
'javelin-workboard-board' => 'fe7cb52a',
|
||||
'javelin-workboard-card' => 'c587b80f',
|
||||
'javelin-workboard-column' => 'bae58312',
|
||||
'javelin-workboard-column' => '21df4ff5',
|
||||
'javelin-workboard-controller' => '55baf5ed',
|
||||
'javelin-workflow' => '1e911d0f',
|
||||
'lightbox-attachment-css' => '7acac05d',
|
||||
|
@ -1162,6 +1162,10 @@ return array(
|
|||
'javelin-stratcom',
|
||||
'conpherence-thread-manager',
|
||||
),
|
||||
'21df4ff5' => array(
|
||||
'javelin-install',
|
||||
'javelin-workboard-card',
|
||||
),
|
||||
'2290aeef' => array(
|
||||
'javelin-install',
|
||||
'javelin-dom',
|
||||
|
@ -1922,10 +1926,6 @@ return array(
|
|||
'javelin-uri',
|
||||
'phabricator-notification',
|
||||
),
|
||||
'bae58312' => array(
|
||||
'javelin-install',
|
||||
'javelin-workboard-card',
|
||||
),
|
||||
'bb1dd507' => array(
|
||||
'javelin-behavior',
|
||||
'javelin-stratcom',
|
||||
|
|
|
@ -222,6 +222,7 @@ JX.install('WorkboardColumn', {
|
|||
|
||||
var points = {};
|
||||
var count = 0;
|
||||
var decimal_places = 0;
|
||||
for (var phid in cards) {
|
||||
var card = cards[phid];
|
||||
|
||||
|
@ -238,6 +239,15 @@ JX.install('WorkboardColumn', {
|
|||
points[status] = 0;
|
||||
}
|
||||
points[status] += card_points;
|
||||
|
||||
// Count the number of decimal places in the point value with the
|
||||
// most decimal digits. We'll use the same precision when rendering
|
||||
// the point sum. This avoids rounding errors and makes the display
|
||||
// a little more consistent.
|
||||
var parts = card_points.toString().split('.');
|
||||
if (parts[1]) {
|
||||
decimal_places = Math.max(decimal_places, parts[1].length);
|
||||
}
|
||||
}
|
||||
|
||||
count++;
|
||||
|
@ -247,6 +257,7 @@ JX.install('WorkboardColumn', {
|
|||
for (var k in points) {
|
||||
total_points += points[k];
|
||||
}
|
||||
total_points = total_points.toFixed(decimal_places);
|
||||
|
||||
var limit = this.getPointLimit();
|
||||
|
||||
|
|
Loading…
Reference in a new issue