mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
Clean up code, remove unused methods.
This commit is contained in:
@@ -168,10 +168,10 @@ class JournalRepository implements JournalRepositoryInterface
|
||||
Log::debug(sprintf('Hash of hash is: %s', $hashOfHash));
|
||||
|
||||
$result = TransactionJournalMeta::withTrashed()
|
||||
->leftJoin('transaction_journals', 'transaction_journals.id', '=', 'journal_meta.transaction_journal_id')
|
||||
->where('hash', $hashOfHash)
|
||||
->where('name', 'importHashV2')
|
||||
->first(['journal_meta.*']);
|
||||
->leftJoin('transaction_journals', 'transaction_journals.id', '=', 'journal_meta.transaction_journal_id')
|
||||
->where('hash', $hashOfHash)
|
||||
->where('name', 'importHashV2')
|
||||
->first(['journal_meta.*']);
|
||||
if (null === $result) {
|
||||
Log::debug('Result is null');
|
||||
}
|
||||
@@ -350,16 +350,14 @@ class JournalRepository implements JournalRepositoryInterface
|
||||
$journal->save();
|
||||
|
||||
// create meta entry
|
||||
$journal->setMeta($field, $carbon);
|
||||
$this->setMetaDate($journal, $field, $carbon);
|
||||
|
||||
// return that one instead.
|
||||
return $carbon->format('Y-m-d');
|
||||
}
|
||||
$metaField = $journal->getMeta($field);
|
||||
$metaField = $this->getMetaDate($journal, $field);
|
||||
if (null !== $metaField) {
|
||||
$carbon = new Carbon($metaField);
|
||||
|
||||
return $carbon->format('Y-m-d');
|
||||
return $metaField->format('Y-m-d');
|
||||
}
|
||||
|
||||
return '';
|
||||
|
@@ -86,8 +86,8 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface
|
||||
*/
|
||||
public function canAddAmount(PiggyBank $piggyBank, string $amount): bool
|
||||
{
|
||||
$leftOnAccount = $piggyBank->leftOnAccount(new Carbon);
|
||||
$savedSoFar = (string)$piggyBank->currentRelevantRep()->currentamount;
|
||||
$leftOnAccount = $this->leftOnAccount($piggyBank, new Carbon);
|
||||
$savedSoFar = (string)$this->getRepetition($piggyBank)->currentamount;
|
||||
$leftToSave = bcsub($piggyBank->targetamount, $savedSoFar);
|
||||
$maxAmount = (string)min(round($leftOnAccount, 12), round($leftToSave, 12));
|
||||
|
||||
@@ -415,7 +415,7 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface
|
||||
*/
|
||||
public function removeAmount(PiggyBank $piggyBank, string $amount): bool
|
||||
{
|
||||
$repetition = $piggyBank->currentRelevantRep();
|
||||
$repetition = $this->getRepetition($piggyBank);
|
||||
$repetition->currentamount = bcsub($repetition->currentamount, $amount);
|
||||
$repetition->save();
|
||||
|
||||
|
Reference in New Issue
Block a user