Various code changes.

This commit is contained in:
James Cole
2024-01-01 08:17:15 +01:00
parent fdcd31652a
commit 5664695a92
7 changed files with 63 additions and 24 deletions

View File

@@ -470,16 +470,16 @@
},
{
"name": "symfony/dependency-injection",
"version": "v7.0.1",
"version": "v7.0.2",
"source": {
"type": "git",
"url": "https://github.com/symfony/dependency-injection.git",
"reference": "f6667642954bce638733f254c39e5b5700b47ba4"
"reference": "bd25ef7c937b9da12510bdc4f1c66728f19620e3"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/dependency-injection/zipball/f6667642954bce638733f254c39e5b5700b47ba4",
"reference": "f6667642954bce638733f254c39e5b5700b47ba4",
"url": "https://api.github.com/repos/symfony/dependency-injection/zipball/bd25ef7c937b9da12510bdc4f1c66728f19620e3",
"reference": "bd25ef7c937b9da12510bdc4f1c66728f19620e3",
"shasum": ""
},
"require": {
@@ -530,7 +530,7 @@
"description": "Allows you to standardize and centralize the way objects are constructed in your application",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/dependency-injection/tree/v7.0.1"
"source": "https://github.com/symfony/dependency-injection/tree/v7.0.2"
},
"funding": [
{
@@ -546,7 +546,7 @@
"type": "tidelift"
}
],
"time": "2023-12-01T15:10:06+00:00"
"time": "2023-12-28T19:18:20+00:00"
},
{
"name": "symfony/deprecation-contracts",
@@ -927,16 +927,16 @@
},
{
"name": "symfony/var-exporter",
"version": "v7.0.1",
"version": "v7.0.2",
"source": {
"type": "git",
"url": "https://github.com/symfony/var-exporter.git",
"reference": "a3d7c877414fcd59ab7075ecdc3b8f9c00f7bcc3"
"reference": "345c62fefe92243c3a06fc0cc65f2ec1a47e0764"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/var-exporter/zipball/a3d7c877414fcd59ab7075ecdc3b8f9c00f7bcc3",
"reference": "a3d7c877414fcd59ab7075ecdc3b8f9c00f7bcc3",
"url": "https://api.github.com/repos/symfony/var-exporter/zipball/345c62fefe92243c3a06fc0cc65f2ec1a47e0764",
"reference": "345c62fefe92243c3a06fc0cc65f2ec1a47e0764",
"shasum": ""
},
"require": {
@@ -981,7 +981,7 @@
"serialize"
],
"support": {
"source": "https://github.com/symfony/var-exporter/tree/v7.0.1"
"source": "https://github.com/symfony/var-exporter/tree/v7.0.2"
},
"funding": [
{
@@ -997,7 +997,7 @@
"type": "tidelift"
}
],
"time": "2023-11-30T11:38:21+00:00"
"time": "2023-12-27T08:42:13+00:00"
}
],
"aliases": [],

View File

@@ -171,7 +171,7 @@ class EditController extends Controller
$data = $request->getAccountData();
$this->repository->update($account, $data);
Log::channel('audit')->info(sprintf('Updated account #%d.', $account->id), $data);
$request->session()->flash('success', (string) trans('firefly.updated_account', ['name' => $account->name]));
// store new attachment(s):

View File

@@ -117,6 +117,8 @@ class EditController extends Controller
$billData = $request->getBillData();
$bill = $this->repository->update($bill, $billData);
Log::channel('audit')->info(sprintf('Updated bill #%d.', $bill->id), $billData);
$request->session()->flash('success', (string)trans('firefly.updated_bill', ['name' => $bill->name]));
app('preferences')->mark();

View File

@@ -246,6 +246,17 @@ class TagRepository implements TagRepositoryInterface
/** @var array $journal */
foreach ($journals as $journal) {
$found = false;
/** @var array $localTag */
foreach ($journal['tags'] as $localTag) {
if ($localTag['id'] === $tag->id) {
$found = true;
}
}
if (false === $found) {
continue;
}
$currencyId = (int) $journal['currency_id'];
$sums[$currencyId] ??= [
'currency_id' => $currencyId,

View File

@@ -347,7 +347,7 @@ trait PeriodOverview
$cache->addProperty('tag-period-entries');
$cache->addProperty($tag->id);
if ($cache->has()) {
return $cache->get();
// return $cache->get();
}
/** @var array $dates */
@@ -378,6 +378,11 @@ trait PeriodOverview
$collector->setTypes([TransactionType::TRANSFER]);
$transferSet = $collector->getExtractedJournals();
// filer all of them:
$earnedSet = $this->filterJournalsByTag($earnedSet, $tag);
$spentSet = $this->filterJournalsByTag($spentSet, $tag);
$transferSet = $this->filterJournalsByTag($transferSet, $tag);
foreach ($dates as $currentDate) {
$spent = $this->filterJournalsByDate($spentSet, $currentDate['start'], $currentDate['end']);
$earned = $this->filterJournalsByDate($earnedSet, $currentDate['start'], $currentDate['end']);
@@ -551,4 +556,25 @@ trait PeriodOverview
return $return;
}
private function filterJournalsByTag(array $set, Tag $tag): array
{
$return = [];
foreach ($set as $entry) {
$found = false;
/** @var array $localTag */
foreach ($entry['tags'] as $localTag) {
if ($localTag['id'] === $tag->id) {
$found = true;
}
}
if (false === $found) {
continue;
}
$return[] = $entry;
}
return $return;
}
}