diff --git a/app/lib/FireflyIII/Shared/Toolkit/Reminders.php b/app/lib/FireflyIII/Shared/Toolkit/Reminders.php index 555663d9a0..31d3e380f0 100644 --- a/app/lib/FireflyIII/Shared/Toolkit/Reminders.php +++ b/app/lib/FireflyIII/Shared/Toolkit/Reminders.php @@ -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();