File tree Expand file tree Collapse file tree 2 files changed +6
-4
lines changed
Expand file tree Collapse file tree 2 files changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -7,14 +7,14 @@ import generateRanges from '../generate-ranges';
77describe ( 'generateRanges()' , ( ) => {
88 it ( 'should generate ranges' , ( ) => {
99 let stats = {
10- min : 1.99 ,
10+ min : 1.01 ,
1111 max : 4999.98 ,
1212 avg : 243.349 ,
1313 sum : 2433490.0
1414 } ;
1515 let expected = [
16- { to : 1 } ,
17- { from : 1 , to : 80 } ,
16+ { to : 2 } ,
17+ { from : 2 , to : 80 } ,
1818 { from : 80 , to : 160 } ,
1919 { from : 160 , to : 240 } ,
2020 { from : 240 , to : 1820 } ,
Original file line number Diff line number Diff line change @@ -26,10 +26,12 @@ function generateRanges(stats) {
2626 let from ;
2727 let facetValues = [ ] ;
2828 if ( min !== max ) {
29- next = round ( min , precision ) ;
29+ next = min ;
30+
3031 facetValues . push ( {
3132 to : next
3233 } ) ;
34+
3335 while ( next < avg ) {
3436 from = facetValues [ facetValues . length - 1 ] . to ;
3537 next = round ( from + ( avg - min ) / 3 , precision ) ;
You can’t perform that action at this time.
0 commit comments