Browse Source

Merge pull request 'staging' (#95) from staging into master

Reviewed-on: ordo/adw-backend#95
pull/3/head
ibnu 2 years ago
parent
commit
8940a83d94
  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