Compare commits

..

5 Commits

Author SHA1 Message Date
github-actions[bot]
2af5e6eeef Merge pull request #10942 from firefly-iii/release-1758460508
🤖 Automatically merge the PR into the develop branch.
2025-09-21 15:15:17 +02:00
JC5
013c43f9f2 🤖 Auto commit for release 'develop' on 2025-09-21 2025-09-21 15:15:08 +02:00
James Cole
7e08a1f33c Possible fix for #10940, not sure. 2025-09-21 15:11:16 +02:00
James Cole
e592b56d7a Merge branch 'develop' of github.com:firefly-iii/firefly-iii into develop 2025-09-21 15:06:32 +02:00
James Cole
90623101a3 Add earned + spent, needs cleaning up still. 2025-09-21 08:54:26 +02:00
4 changed files with 54 additions and 37 deletions

View File

@@ -130,7 +130,7 @@ class PiggyBankEnrichment implements EnrichmentInterface
}
$this->amounts[$id][$accountId]['current_amount'] = bcadd($this->amounts[$id][$accountId]['current_amount'], (string) $item->current_amount);
if (null !== $this->amounts[$id][$accountId]['pc_current_amount'] && null !== $item->native_current_amount) {
$this->amounts[$id][$accountId]['pc_current_amount'] = bcadd($this->amounts[$id][$accountId]['pc_current_amount'], $item->native_current_amount);
$this->amounts[$id][$accountId]['pc_current_amount'] = bcadd($this->amounts[$id][$accountId]['pc_current_amount'], (string) $item->native_current_amount);
}
}

16
composer.lock generated
View File

@@ -11891,16 +11891,16 @@
},
{
"name": "phpunit/phpunit",
"version": "12.3.11",
"version": "12.3.12",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git",
"reference": "6a62f2b394e042884e4997ddc8b8db1ce56a0009"
"reference": "729861f66944204f5b446ee1cb156f02f2a439a6"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/6a62f2b394e042884e4997ddc8b8db1ce56a0009",
"reference": "6a62f2b394e042884e4997ddc8b8db1ce56a0009",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/729861f66944204f5b446ee1cb156f02f2a439a6",
"reference": "729861f66944204f5b446ee1cb156f02f2a439a6",
"shasum": ""
},
"require": {
@@ -11914,12 +11914,12 @@
"phar-io/manifest": "^2.0.4",
"phar-io/version": "^3.2.1",
"php": ">=8.3",
"phpunit/php-code-coverage": "^12.3.7",
"phpunit/php-code-coverage": "^12.3.8",
"phpunit/php-file-iterator": "^6.0.0",
"phpunit/php-invoker": "^6.0.0",
"phpunit/php-text-template": "^5.0.0",
"phpunit/php-timer": "^8.0.0",
"sebastian/cli-parser": "^4.1.0",
"sebastian/cli-parser": "^4.2.0",
"sebastian/comparator": "^7.1.3",
"sebastian/diff": "^7.0.0",
"sebastian/environment": "^8.0.3",
@@ -11968,7 +11968,7 @@
"support": {
"issues": "https://github.com/sebastianbergmann/phpunit/issues",
"security": "https://github.com/sebastianbergmann/phpunit/security/policy",
"source": "https://github.com/sebastianbergmann/phpunit/tree/12.3.11"
"source": "https://github.com/sebastianbergmann/phpunit/tree/12.3.12"
},
"funding": [
{
@@ -11992,7 +11992,7 @@
"type": "tidelift"
}
],
"time": "2025-09-14T06:21:44+00:00"
"time": "2025-09-21T12:23:01+00:00"
},
{
"name": "rector/rector",

View File

@@ -79,7 +79,7 @@ return [
// see cer.php for exchange rates feature flag.
],
'version' => 'develop/2025-09-21',
'build_time' => 1758437799,
'build_time' => 1758460398,
'api_version' => '2.1.0', // field is no longer used.
'db_version' => 26,

View File

@@ -54,12 +54,21 @@ export default () => ({
if (data.hasOwnProperty(i)) {
let current = data[i];
let code = current.currency_code;
if (!series.hasOwnProperty(code)) {
series[code] = {
name: code,
yAxisID: '',
data: {},
};
// create two series, "spent" and "earned".
for(const type of ['spent', 'earned']) {
let typeCode = code + '_' + type;
if (!series.hasOwnProperty(typeCode)) {
series[typeCode] = {
name: typeCode,
code: code,
type: type,
yAxisID: '',
data: {},
};
}
}
if (!currencies.includes(code)) {
currencies.push(code);
}
}
@@ -76,31 +85,38 @@ export default () => ({
code = current.primary_currency_code;
}
// loop series, add 0 if not present or add actual amount.
for (const ii in series) {
if (series.hasOwnProperty(ii)) {
let amount = 0.0;
if (code === ii) {
// this series' currency matches this column's currency.
amount = parseFloat(current.entries.spent);
if(this.convertToPrimary) {
amount = parseFloat(current.entries.pc_entries.spent);
// twice again, for speny AND earned.
for(const type of ['spent', 'earned']) {
let typeCode = code + '_' + type;
// loop series, add 0 if not present or add actual amount.
for (const ii in series) {
if (series.hasOwnProperty(typeCode)) {
let amount = 0.0;
if (typeCode === ii) {
// this series' currency matches this column's currency.
amount = parseFloat(current.entries[type]);
if(this.convertToPrimary) {
amount = parseFloat(current.entries.pc_entries[type]);
}
yAxis = 'y' + typeCode;
}
if (series[typeCode].data.hasOwnProperty(current.label)) {
// there is a value for this particular currency. The amount from this column will be added.
// (even if this column isn't recorded in this currency and a new filler value is written)
// this is so currency conversion works.
series[typeCode].data[current.label] = series[typeCode].data[current.label] + amount;
}
yAxis = 'y' + code;
}
if (series[ii].data.hasOwnProperty(current.label)) {
// there is a value for this particular currency. The amount from this column will be added.
// (even if this column isn't recorded in this currency and a new filler value is written)
// this is so currency conversion works.
series[ii].data[current.label] = series[ii].data[current.label] + amount;
}
if (!series[ii].data.hasOwnProperty(current.label)) {
// this column's amount is not yet set in this series.
series[ii].data[current.label] = amount;
if (!series[typeCode].data.hasOwnProperty(current.label)) {
// this column's amount is not yet set in this series.
series[typeCode].data[current.label] = amount;
}
}
}
}
// add label to x-axis, not unimportant.
if (!options.data.labels.includes(current.label)) {
options.data.labels.push(current.label);
@@ -111,9 +127,10 @@ export default () => ({
let count = 0;
for (const i in series) {
let yAxisID = 'y' + i;
let currencyCode = i.replace('_spent', '').replace('_earned', '');
let dataset = {
label: i,
currency_code: i,
currency_code: currencyCode,
yAxisID: yAxisID,
data: [],
// backgroundColor: getColors(null, 'background'),