@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

+17 -6
+6 -6
resources/celerity/map.php
··· 495 495 'rsrc/js/application/policy/behavior-policy-rule-editor.js' => '5e9f347c', 496 496 'rsrc/js/application/projects/WorkboardBoard.js' => 'fe7cb52a', 497 497 'rsrc/js/application/projects/WorkboardCard.js' => 'c587b80f', 498 - 'rsrc/js/application/projects/WorkboardColumn.js' => 'bae58312', 498 + 'rsrc/js/application/projects/WorkboardColumn.js' => '21df4ff5', 499 499 'rsrc/js/application/projects/WorkboardController.js' => '55baf5ed', 500 500 'rsrc/js/application/projects/behavior-project-boards.js' => '14a1faae', 501 501 'rsrc/js/application/projects/behavior-project-create.js' => '065227cc', ··· 825 825 'javelin-websocket' => 'e292eaf4', 826 826 'javelin-workboard-board' => 'fe7cb52a', 827 827 'javelin-workboard-card' => 'c587b80f', 828 - 'javelin-workboard-column' => 'bae58312', 828 + 'javelin-workboard-column' => '21df4ff5', 829 829 'javelin-workboard-controller' => '55baf5ed', 830 830 'javelin-workflow' => '1e911d0f', 831 831 'lightbox-attachment-css' => '7acac05d', ··· 1161 1161 'javelin-workflow', 1162 1162 'javelin-stratcom', 1163 1163 'conpherence-thread-manager', 1164 + ), 1165 + '21df4ff5' => array( 1166 + 'javelin-install', 1167 + 'javelin-workboard-card', 1164 1168 ), 1165 1169 '2290aeef' => array( 1166 1170 'javelin-install', ··· 1921 1925 'javelin-behavior', 1922 1926 'javelin-uri', 1923 1927 'phabricator-notification', 1924 - ), 1925 - 'bae58312' => array( 1926 - 'javelin-install', 1927 - 'javelin-workboard-card', 1928 1928 ), 1929 1929 'bb1dd507' => array( 1930 1930 'javelin-behavior',
+11
webroot/rsrc/js/application/projects/WorkboardColumn.js
··· 222 222 223 223 var points = {}; 224 224 var count = 0; 225 + var decimal_places = 0; 225 226 for (var phid in cards) { 226 227 var card = cards[phid]; 227 228 ··· 238 239 points[status] = 0; 239 240 } 240 241 points[status] += card_points; 242 + 243 + // Count the number of decimal places in the point value with the 244 + // most decimal digits. We'll use the same precision when rendering 245 + // the point sum. This avoids rounding errors and makes the display 246 + // a little more consistent. 247 + var parts = card_points.toString().split('.'); 248 + if (parts[1]) { 249 + decimal_places = Math.max(decimal_places, parts[1].length); 250 + } 241 251 } 242 252 243 253 count++; ··· 247 257 for (var k in points) { 248 258 total_points += points[k]; 249 259 } 260 + total_points = total_points.toFixed(decimal_places); 250 261 251 262 var limit = this.getPointLimit(); 252 263