mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-20 19:35:16 +00:00
Fix percentage call.
This commit is contained in:
@@ -203,25 +203,26 @@ export default {
|
|||||||
let budgetId = parseInt(current.attributes.budget_id);
|
let budgetId = parseInt(current.attributes.budget_id);
|
||||||
let currencyId = parseInt(current.attributes.currency_id);
|
let currencyId = parseInt(current.attributes.currency_id);
|
||||||
let spentFloat = parseFloat(current.attributes.spent);
|
let spentFloat = parseFloat(current.attributes.spent);
|
||||||
|
let spentFloatPos = parseFloat(current.attributes.spent) * -1;
|
||||||
let amount = parseFloat(current.attributes.amount);
|
let amount = parseFloat(current.attributes.amount);
|
||||||
let period = current.attributes.period ?? 'other';
|
let period = current.attributes.period ?? 'other';
|
||||||
let pctGreen = 0;
|
let pctGreen = 0;
|
||||||
let pctOrange = 0;
|
let pctOrange = 0;
|
||||||
let pctRed = 0;
|
let pctRed = 0;
|
||||||
console.log('Collected "' + period + '" budget limit #' + currentId + ' (part of budget #' + budgetId + ')');
|
//console.log('Collected "' + period + '" budget limit #' + currentId + ' (part of budget #' + budgetId + ')');
|
||||||
console.log('Spent ' + spentFloat + ' of ' + amount);
|
//console.log('Spent ' + spentFloat + ' of ' + amount);
|
||||||
|
|
||||||
// remove budget info from rawBudgets if it's there:
|
// remove budget info from rawBudgets if it's there:
|
||||||
this.filterBudgets(budgetId, currencyId);
|
this.filterBudgets(budgetId, currencyId);
|
||||||
|
|
||||||
// spent within budget:
|
// spent within budget:
|
||||||
if (0.0 !== spentFloat && spentFloat * -1 < amount) {
|
if (0.0 !== spentFloat && spentFloatPos < amount) {
|
||||||
pctGreen = (spentFloat * -1) / (amount * 100);
|
pctGreen = (spentFloatPos / amount) * 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
// spent over budget
|
// spent over budget
|
||||||
if (0.0 !== spentFloat && (spentFloat * -1) > amount) {
|
if (0.0 !== spentFloatPos && spentFloatPos > amount) {
|
||||||
pctOrange = (amount / (spentFloat * -1)) * 100;
|
pctOrange = (spentFloatPos / amount) * 100;
|
||||||
pctRed = 100 - pctOrange;
|
pctRed = 100 - pctOrange;
|
||||||
}
|
}
|
||||||
let obj = {
|
let obj = {
|
||||||
|
2
public/v2/js/dashboard.js
vendored
2
public/v2/js/dashboard.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user