mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-11-08 18:58:07 +00:00
Some more last-minute fixes.
This commit is contained in:
@@ -61,6 +61,7 @@ use Steam;
|
|||||||
*/
|
*/
|
||||||
class JournalCollector implements JournalCollectorInterface
|
class JournalCollector implements JournalCollectorInterface
|
||||||
{
|
{
|
||||||
|
|
||||||
/** @var array */
|
/** @var array */
|
||||||
private $accountIds = [];
|
private $accountIds = [];
|
||||||
/** @var int */
|
/** @var int */
|
||||||
@@ -107,7 +108,8 @@ class JournalCollector implements JournalCollectorInterface
|
|||||||
];
|
];
|
||||||
/** @var array */
|
/** @var array */
|
||||||
private $filters = [InternalTransferFilter::class];
|
private $filters = [InternalTransferFilter::class];
|
||||||
|
/** @var bool */
|
||||||
|
private $ignoreCache = false;
|
||||||
/** @var bool */
|
/** @var bool */
|
||||||
private $joinedBudget = false;
|
private $joinedBudget = false;
|
||||||
/** @var bool */
|
/** @var bool */
|
||||||
@@ -258,12 +260,15 @@ class JournalCollector implements JournalCollectorInterface
|
|||||||
foreach ($this->filters as $filter) {
|
foreach ($this->filters as $filter) {
|
||||||
$cache->addProperty((string)$filter);
|
$cache->addProperty((string)$filter);
|
||||||
}
|
}
|
||||||
if ($cache->has()) {
|
if (false === $this->ignoreCache && $cache->has()) {
|
||||||
Log::debug(sprintf('Return cache of query with ID "%s".', $key));
|
Log::debug(sprintf('Return cache of query with ID "%s".', $key));
|
||||||
|
|
||||||
return $cache->get(); // @codeCoverageIgnore
|
return $cache->get(); // @codeCoverageIgnore
|
||||||
}
|
|
||||||
|
|
||||||
|
}
|
||||||
|
if (true === $this->ignoreCache) {
|
||||||
|
Log::debug('Ignore cache in journal collector.');
|
||||||
|
}
|
||||||
/** @var Collection $set */
|
/** @var Collection $set */
|
||||||
$set = $this->query->get(array_values($this->fields));
|
$set = $this->query->get(array_values($this->fields));
|
||||||
|
|
||||||
@@ -316,6 +321,16 @@ class JournalCollector implements JournalCollectorInterface
|
|||||||
return $journals;
|
return $journals;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return JournalCollectorInterface
|
||||||
|
*/
|
||||||
|
public function ignoreCache(): JournalCollectorInterface
|
||||||
|
{
|
||||||
|
$this->ignoreCache = true;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $filter
|
* @param string $filter
|
||||||
*
|
*
|
||||||
@@ -786,7 +801,7 @@ class JournalCollector implements JournalCollectorInterface
|
|||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private function joinBudgetTables()
|
private function joinBudgetTables(): void
|
||||||
{
|
{
|
||||||
if (!$this->joinedBudget) {
|
if (!$this->joinedBudget) {
|
||||||
// join some extra tables:
|
// join some extra tables:
|
||||||
@@ -811,7 +826,7 @@ class JournalCollector implements JournalCollectorInterface
|
|||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private function joinCategoryTables()
|
private function joinCategoryTables(): void
|
||||||
{
|
{
|
||||||
if (!$this->joinedCategory) {
|
if (!$this->joinedCategory) {
|
||||||
// join some extra tables:
|
// join some extra tables:
|
||||||
@@ -841,7 +856,7 @@ class JournalCollector implements JournalCollectorInterface
|
|||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private function joinOpposingTables()
|
private function joinOpposingTables(): void
|
||||||
{
|
{
|
||||||
if (!$this->joinedOpposing) {
|
if (!$this->joinedOpposing) {
|
||||||
Log::debug('joinedOpposing is false');
|
Log::debug('joinedOpposing is false');
|
||||||
@@ -873,7 +888,7 @@ class JournalCollector implements JournalCollectorInterface
|
|||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private function joinTagTables()
|
private function joinTagTables(): void
|
||||||
{
|
{
|
||||||
if (!$this->joinedTag) {
|
if (!$this->joinedTag) {
|
||||||
// join some extra tables:
|
// join some extra tables:
|
||||||
|
|||||||
@@ -78,6 +78,11 @@ interface JournalCollectorInterface
|
|||||||
*/
|
*/
|
||||||
public function getPaginatedJournals(): LengthAwarePaginator;
|
public function getPaginatedJournals(): LengthAwarePaginator;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return JournalCollectorInterface
|
||||||
|
*/
|
||||||
|
public function ignoreCache(): JournalCollectorInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $filter
|
* @param string $filter
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -154,7 +154,9 @@ class ImportArrayStorage
|
|||||||
Log::debug(sprintf('Row #%d is a transfer, increase count to %d', ($index + 1), $count));
|
Log::debug(sprintf('Row #%d is a transfer, increase count to %d', ($index + 1), $count));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Log::debug('Count is zero.');
|
if (0 === $count) {
|
||||||
|
Log::debug('Count is zero.');
|
||||||
|
}
|
||||||
if ($count > 0) {
|
if ($count > 0) {
|
||||||
Log::debug(sprintf('Count is %d', $count));
|
Log::debug(sprintf('Count is %d', $count));
|
||||||
$this->checkForTransfers = true;
|
$this->checkForTransfers = true;
|
||||||
@@ -206,16 +208,19 @@ class ImportArrayStorage
|
|||||||
*/
|
*/
|
||||||
private function getTransfers(): void
|
private function getTransfers(): void
|
||||||
{
|
{
|
||||||
|
Log::debug('Now in getTransfers()');
|
||||||
app('preferences')->mark();
|
app('preferences')->mark();
|
||||||
|
|
||||||
/** @var JournalCollectorInterface $collector */
|
/** @var JournalCollectorInterface $collector */
|
||||||
$collector = app(JournalCollectorInterface::class);
|
$collector = app(JournalCollectorInterface::class);
|
||||||
$collector->setUser($this->importJob->user);
|
$collector->setUser($this->importJob->user);
|
||||||
$collector->setAllAssetAccounts()
|
$collector->setAllAssetAccounts()
|
||||||
|
->ignoreCache()
|
||||||
->setTypes([TransactionType::TRANSFER])
|
->setTypes([TransactionType::TRANSFER])
|
||||||
->withOpposingAccount();
|
->withOpposingAccount();
|
||||||
$collector->removeFilter(InternalTransferFilter::class);
|
$collector->removeFilter(InternalTransferFilter::class);
|
||||||
$this->transfers = $collector->getJournals();
|
$this->transfers = $collector->getJournals();
|
||||||
|
Log::debug(sprintf('Count of getTransfers() is %d', $this->transfers->count()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user