Browse Source

Fix getactivity first and last

pull/3/head
Wahyu Ramadhan 1 year ago
parent
commit
2aed8364ab
  1. 10
      app/Http/Controllers/ActivityController.php

10
app/Http/Controllers/ActivityController.php

@ -151,7 +151,10 @@ class ActivityController extends Controller
}
public function getActivityFirst($parentId){
$activity = Activity::where('parent_id', $parentId)->orderByRaw('start_date ASC')->first();
$activity = Activity::where('parent_id', $parentId)->orderByRaw('actual_start ASC')->first();
if (!isset($activity)) {
return null;
}
if($activity->type_activity == "task"){
// Log::info("activity ", [$activity]);
return $activity->actual_start;
@ -162,7 +165,10 @@ class ActivityController extends Controller
}
public function getActivityLast($parentId){
$activity = Activity::where('parent_id', $parentId)->orderByRaw('start_date DESC')->first();
$activity = Activity::where('parent_id', $parentId)->orderByRaw('actual_end DESC')->first();
if (!isset($activity)) {
return null;
}
if($activity->type_activity == "task"){
// Log::info("activity ", [$activity]);
return $activity->actual_end;

Loading…
Cancel
Save