Remove comments

This commit is contained in:
James Cole 2021-02-22 18:40:46 +01:00
parent 5f1d4292ad
commit 860fc507b7
No known key found for this signature in database
GPG Key ID: B5669F9493CDE38D
4 changed files with 20 additions and 41 deletions

View File

@ -91,7 +91,7 @@ trait AccountCollection
$query->orWhereIn('destination.account_id', $accountIds);
}
);
app('log')->debug(sprintf('GroupCollector: setAccounts: %s', implode(', ', $accountIds)));
//app('log')->debug(sprintf('GroupCollector: setAccounts: %s', implode(', ', $accountIds)));
}
return $this;

View File

@ -741,7 +741,7 @@ class GroupCollector implements GroupCollectorInterface
*/
private function startQuery(): void
{
app('log')->debug('GroupCollector::startQuery');
//app('log')->debug('GroupCollector::startQuery');
$this->query = $this->user
//->transactionGroups()
//->leftJoin('transaction_journals', 'transaction_journals.transaction_group_id', 'transaction_groups.id')

View File

@ -463,24 +463,21 @@ class BillRepository implements BillRepositoryInterface
{
$set = new Collection;
$currentStart = clone $start;
Log::debug(sprintf('Now at bill "%s" (%s)', $bill->name, $bill->repeat_freq));
Log::debug(sprintf('First currentstart is %s', $currentStart->format('Y-m-d')));
//Log::debug(sprintf('Now at bill "%s" (%s)', $bill->name, $bill->repeat_freq));
//Log::debug(sprintf('First currentstart is %s', $currentStart->format('Y-m-d')));
while ($currentStart <= $end) {
Log::debug(sprintf('Currentstart is now %s.', $currentStart->format('Y-m-d')));
$nextExpectedMatch = $this->nextDateMatch($bill, $currentStart);
Log::debug(sprintf('Next Date match after %s is %s', $currentStart->format('Y-m-d'), $nextExpectedMatch->format('Y-m-d')));
//Log::debug(sprintf('Next Date match after %s is %s', $currentStart->format('Y-m-d'), $nextExpectedMatch->format('Y-m-d')));
if ($nextExpectedMatch > $end) {// If nextExpectedMatch is after end, we continue
Log::debug(
sprintf('nextExpectedMatch %s is after %s, so we skip this bill now.', $nextExpectedMatch->format('Y-m-d'), $end->format('Y-m-d'))
);
break;
}
$set->push(clone $nextExpectedMatch);
Log::debug(sprintf('Now %d dates in set.', $set->count()));
//Log::debug(sprintf('Now %d dates in set.', $set->count()));
$nextExpectedMatch->addDay();
Log::debug(sprintf('Currentstart (%s) has become %s.', $currentStart->format('Y-m-d'), $nextExpectedMatch->format('Y-m-d')));
//Log::debug(sprintf('Currentstart (%s) has become %s.', $currentStart->format('Y-m-d'), $nextExpectedMatch->format('Y-m-d')));
$currentStart = clone $nextExpectedMatch;
}
@ -489,7 +486,7 @@ class BillRepository implements BillRepositoryInterface
return $date->format('Y-m-d');
}
);
Log::debug(sprintf('Found dates between %s and %s:', $start->format('Y-m-d'), $end->format('Y-m-d')), $simple->toArray());
//Log::debug(sprintf('Found dates between %s and %s:', $start->format('Y-m-d'), $end->format('Y-m-d')), $simple->toArray());
return $set;
}

View File

@ -164,49 +164,49 @@ class BillTransformer extends AbstractTransformer
*/
protected function paidData(Bill $bill): array
{
Log::debug(sprintf('Now in paidData for bill #%d', $bill->id));
//Log::debug(sprintf('Now in paidData for bill #%d', $bill->id));
if (null === $this->parameters->get('start') || null === $this->parameters->get('end')) {
Log::debug('parameters are NULL, return empty array');
// Log::debug('parameters are NULL, return empty array');
return [
'paid_dates' => [],
'next_expected_match' => null,
];
}
Log::debug(sprintf('Parameters are start:%s end:%s', $this->parameters->get('start')->format('Y-m-d'), $this->parameters->get('end')->format('Y-m-d')));
//Log::debug(sprintf('Parameters are start:%s end:%s', $this->parameters->get('start')->format('Y-m-d'), $this->parameters->get('end')->format('Y-m-d')));
/*
* Get from database when bill was paid.
*/
$set = $this->repository->getPaidDatesInRange($bill, $this->parameters->get('start'), $this->parameters->get('end'));
Log::debug(sprintf('Count %d entries in getPaidDatesInRange()', $set->count()));
//Log::debug(sprintf('Count %d entries in getPaidDatesInRange()', $set->count()));
/*
* Grab from array the most recent payment. If none exist, fall back to the start date and pretend *that* was the last paid date.
*/
Log::debug(sprintf('Grab last paid date from function, return %s if it comes up with nothing.', $this->parameters->get('start')->format('Y-m-d')));
//Log::debug(sprintf('Grab last paid date from function, return %s if it comes up with nothing.', $this->parameters->get('start')->format('Y-m-d')));
$lastPaidDate = $this->lastPaidDate($set, $this->parameters->get('start'));
Log::debug(sprintf('Result of lastPaidDate is %s', $lastPaidDate->format('Y-m-d')));
//Log::debug(sprintf('Result of lastPaidDate is %s', $lastPaidDate->format('Y-m-d')));
/*
* The next expected match (nextMatch) is, initially, the bill's date.
*/
$nextMatch = clone $bill->date;
Log::debug(sprintf('Next match is %s (bill->date)', $nextMatch->format('Y-m-d')));
//Log::debug(sprintf('Next match is %s (bill->date)', $nextMatch->format('Y-m-d')));
while ($nextMatch < $lastPaidDate) {
/*
* As long as this date is smaller than the last time the bill was paid, keep jumping ahead.
* For example: 1 jan, 1 feb, etc.
*/
Log::debug(sprintf('next match %s < last paid date %s, so add one period.', $nextMatch->format('Y-m-d'), $lastPaidDate->format('Y-m-d')));
//Log::debug(sprintf('next match %s < last paid date %s, so add one period.', $nextMatch->format('Y-m-d'), $lastPaidDate->format('Y-m-d')));
$nextMatch = app('navigation')->addPeriod($nextMatch, $bill->repeat_freq, $bill->skip);
Log::debug(sprintf('Next match is now %s.', $nextMatch->format('Y-m-d')));
//Log::debug(sprintf('Next match is now %s.', $nextMatch->format('Y-m-d')));
}
if($nextMatch->isSameDay($lastPaidDate)) {
/*
* Add another period because its the same day as the last paid date.
*/
Log::debug('Because the last paid date was on the same day as our next expected match, add another day.');
//Log::debug('Because the last paid date was on the same day as our next expected match, add another day.');
$nextMatch = app('navigation')->addPeriod($nextMatch, $bill->repeat_freq, $bill->skip);
}
/*
@ -236,40 +236,23 @@ class BillTransformer extends AbstractTransformer
*/
protected function payDates(Bill $bill): array
{
Log::debug(sprintf('Now in payDates() for bill #%d', $bill->id));
//Log::debug(sprintf('Now in payDates() for bill #%d', $bill->id));
if (null === $this->parameters->get('start') || null === $this->parameters->get('end')) {
Log::debug('No start or end date, give empty array.');
//Log::debug('No start or end date, give empty array.');
return [];
}
Log::debug(
sprintf(
'Start date is %s, end is %s', $this->parameters->get('start')->format('Y-m-d'),
$this->parameters->get('end')->format('Y-m-d')
)
);
$set = new Collection;
$currentStart = clone $this->parameters->get('start');
$loop = 0;
while ($currentStart <= $this->parameters->get('end')) {
Log::debug(
sprintf(
'In loop #%d, where %s (start param) <= %s (end param).', $loop, $currentStart->format('Y-m-d'),
$this->parameters->get('end')->format('Y-m-d')
)
);
$nextExpectedMatch = $this->nextDateMatch($bill, $currentStart);
Log::debug(sprintf('Next expected match is %s', $nextExpectedMatch->format('Y-m-d')));
// If nextExpectedMatch is after end, we continue:
if ($nextExpectedMatch > $this->parameters->get('end')) {
Log::debug(
sprintf('%s is > %s, so were not going to use it.', $nextExpectedMatch->format('Y-m-d'), $this->parameters->get('end')->format('Y-m-d'))
);
break;
}
// add to set
$set->push(clone $nextExpectedMatch);
Log::debug(sprintf('Add next expected match (%s) to set because its in the current start/end range, which now contains %d item(s)', $nextExpectedMatch->format('Y-m-d'), $set->count()));
$nextExpectedMatch->addDay();
$currentStart = clone $nextExpectedMatch;
$loop++;
@ -280,7 +263,6 @@ class BillTransformer extends AbstractTransformer
}
);
$array = $simple->toArray();
Log::debug(sprintf('Loop has ended after %d loops', $loop), $array);
return $array;
}