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