granularity isn't what you think it is

This commit is contained in:
Gwenhael Le Moine 2019-11-21 15:47:09 +01:00
parent 5151b2fc79
commit 53bc76aeab
No known key found for this signature in database
GPG key ID: FDFE3669426707A7

View file

@ -94,19 +94,19 @@
Controls.period.set( current_period ); Controls.period.set( current_period );
}, },
}, },
granularity: { /* granularity: {
set: ( value ) => { * set: ( value ) => {
if ( !isNaN( parseInt( value ) ) ) { * if ( !isNaN( parseInt( value ) ) ) {
granularity = parseInt( value ); * granularity = parseInt( value );
monthly(); * monthly();
} * }
} * }
} * } */
}; };
const monthly = () => { const monthly = () => {
API.balance( current_period.toISOString().split("T")[0].slice( 0, -3 ), ["Expenses"].join(" "), granularity ) API.balance( current_period.toISOString().split("T")[0].slice( 0, -3 ), ["Expenses"].join(" "), 999 )
.then( balance => { .then( balance => {
const total = balance.reduce( (memo, line) => memo + line.amount, 0 ); const total = balance.reduce( (memo, line) => memo + line.amount, 0 );
@ -130,9 +130,9 @@
<button onclick="Controls.period.next()">+</button> <button onclick="Controls.period.next()">+</button>
<h3 id="display"></h3> <h3 id="display"></h3>
</div> </div>
<div id="granularity"> <!-- <div id="granularity">
<input oninput="Controls.granularity.set( this.value );"> <input oninput="Controls.granularity.set( this.value );">
</div> </div> -->
</div> </div>
<div id="month"> <div id="month">
<div id="donut" style="height: 256; width: 256;"></div> <div id="donut" style="height: 256; width: 256;"></div>