Browse Source

Fix successor duration

pull/3/head
Wahyu Ramadhan 1 year ago
parent
commit
b79f558b40
  1. 5
      app/Models/VersionGantt.php

5
app/Models/VersionGantt.php

@ -4,6 +4,7 @@ namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use App\Models\Activity;
use App\Models\Link;
use DateTime;
class VersionGantt extends Model
@ -47,9 +48,13 @@ class VersionGantt extends Model
}
$activities = Activity::where('version_gantt_id', $this->id)->get();
foreach ($activities as $value) {
$exist = Link::where('t_activity_id', $value->id)->exists();
$startDate = new DateTime($value->start_date);
$endDate = new DateTime($value->end_date);
$duration = $endDate->diff($startDate)->days + 1;
if ($exist) {
$duration--;
}
// Iterate through each day and subtract the days off
for ($i = 0; $i < $duration; $i++) {

Loading…
Cancel
Save