From a5cf0542f4ac466c63ce107762ee8139393670eb Mon Sep 17 00:00:00 2001 From: gazandic <gazandic@gmail.com> Date: Tue, 5 Apr 2016 17:23:59 +0700 Subject: [PATCH] debug jumlah tps tambah terus --- app/Http/Controllers/ScheduleController.php | 24 +++++++++++---------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/app/Http/Controllers/ScheduleController.php b/app/Http/Controllers/ScheduleController.php index 85a38c0..144b3c4 100644 --- a/app/Http/Controllers/ScheduleController.php +++ b/app/Http/Controllers/ScheduleController.php @@ -144,17 +144,19 @@ class ScheduleController extends Controller } else if ($this->has_role('edit_schedule')) { - $sched->is_done = Input::get('is_done'); - $sched->save(); - $tps = Tps::find($sched->id_tps); - $tps->capacity_now += $sched->amount; - if ($tps->capacity_now >= $tps->capacity_full) - { - $this->notify('TPS '.$tps->nama.' penuh'); - $tps->capacity_now = $tps->capacity_full; - $tps->is_full = 1; - } - $tps->save(); + if($sched->is_done!=Input::get('is_done')){ + $sched->is_done = Input::get('is_done'); + $sched->save(); + $tps = Tps::find($sched->id_tps); + $tps->capacity_now += $sched->amount; + if ($tps->capacity_now >= $tps->capacity_full) + { + $this->notify('TPS '.$tps->nama.' penuh'); + $tps->capacity_now = $tps->capacity_full; + $tps->is_full = 1; + } + $tps->save(); + } return redirect('/schedule'); } -- GitLab