mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-01-03 12:47:17 -06:00
Fixed a bug where the end date would be incorrectly calculated.
This commit is contained in:
parent
ad69011ac5
commit
ccffae287d
@ -80,69 +80,6 @@ class Reminders
|
||||
// return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function updatePiggyBankReminders()
|
||||
{
|
||||
// $piggyBanks = \Auth::user()->piggybanks()->where('targetdate', '>=', Carbon::now()->format('Y-m-d'))->whereNotNull('reminder')->where('remind_me', 1)
|
||||
// ->get();
|
||||
//
|
||||
// /** @var \FireflyIII\Shared\Toolkit\Date $dateKit */
|
||||
// $dateKit = \App::make('FireflyIII\Shared\Toolkit\Date');
|
||||
//
|
||||
// $today = Carbon::now();
|
||||
//
|
||||
//
|
||||
// /** @var \Piggybank $piggyBank */
|
||||
// foreach ($piggyBanks as $piggyBank) {
|
||||
// /*
|
||||
// * Loop from today until end?
|
||||
// */
|
||||
// $end = $piggyBank->targetdate;
|
||||
// $start = Carbon::now();
|
||||
//
|
||||
// /*
|
||||
// * Create a reminder for the current period:
|
||||
// */
|
||||
// /*
|
||||
// * * type: Piggybank, Test
|
||||
// * action_uri: where to go when the user wants to do this?
|
||||
// * text: full text to present to user
|
||||
// * amount: any relevant amount.
|
||||
// * model: id of relevant model.
|
||||
// */
|
||||
//
|
||||
// while ($start <= $end) {
|
||||
// $currentEnd = $dateKit->addPeriod(clone $start, $piggyBank->reminder, 0);
|
||||
//
|
||||
// $count = \Reminder::where('startdate',$start->format('Y-m-d'))->where('enddate',$currentEnd->format('Y-m-d'))->count();
|
||||
// if ($start >= $today && $start <= $today && $count == 0) {
|
||||
//
|
||||
//
|
||||
// $reminder = new \Reminder;
|
||||
// $reminder->active = 1;
|
||||
// $reminder->user()->associate(\Auth::user());
|
||||
// $reminder->startdate = clone $start;
|
||||
// $reminder->enddate = $currentEnd;
|
||||
// $reminder->title = 'Add money to "'.e($piggyBank->name).'"';
|
||||
// $amount = $piggyBank->amountPerReminder();
|
||||
// $data = ['type' => 'Piggybank', 'icon' => 'fa-sort-amount-asc', 'text' =>
|
||||
// 'If you want to save up the full amount of "' . e($piggyBank->name) . '", add ' . mf($amount) . ' to account "' . e(
|
||||
// $piggyBank->account->name
|
||||
// ) . '". Don\'t forget to connect the transfer to this piggy bank!', 'amount' => $amount, 'model' => $piggyBank->id
|
||||
//
|
||||
// ];
|
||||
// $reminder->data = $data;
|
||||
// $reminder->save();
|
||||
// }
|
||||
// $start = $dateKit->addPeriod($start, $piggyBank->reminder, 0);
|
||||
// }
|
||||
//
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
public function updateReminders()
|
||||
{
|
||||
|
||||
@ -180,7 +117,7 @@ class Reminders
|
||||
// break when no longer relevant:
|
||||
continue;
|
||||
}
|
||||
$end = $dateKit->endOfPeriod(Carbon::now(), $piggybank->reminder);
|
||||
$end = $dateKit->endOfPeriod($start, $piggybank->reminder);
|
||||
// should have a reminder for this period:
|
||||
/** @var \Collection $reminders */
|
||||
$reminders = $piggybank->reminders()->dateIs($start, $end)->get();
|
||||
|
Loading…
Reference in New Issue
Block a user