Browse Source

Fix ftth & fix scurve duration span

pull/3/head
Wahyu Ramadhan 2 years ago
parent
commit
ce46b3b61c
  1. 2
      app/Console/Commands/CalculateSCurve.php
  2. 6
      app/Helpers/MasterFunctionsHelper.php
  3. 11
      app/Models/HierarchyFtth.php

2
app/Console/Commands/CalculateSCurve.php

@ -25,7 +25,5 @@ class CalculateSCurve extends Command
$project->scurve = json_encode($data); $project->scurve = json_encode($data);
$project->calculation_status = true; $project->calculation_status = true;
$project->save(); $project->save();
return $data;
} }
} }

6
app/Helpers/MasterFunctionsHelper.php

@ -473,11 +473,11 @@ class MasterFunctionsHelper {
$minDate = $dataProject->mulai_proyek; $minDate = $dataProject->mulai_proyek;
$begin = new \DateTime($minDate.' Monday'); $begin = new \DateTime($minDate);
$begin->modify('last Monday'); $begin->modify('last Monday');
if(isset($dataPayload['end_date'])){ if(isset($dataPayload['end_date'])){
$maxDate = $dataPayload['end_date']; $maxDate = $dataPayload['end_date'];
$end = new \DateTime($maxDate. ' Friday'); $end = new \DateTime($maxDate);
$end->modify('next Friday'); $end->modify('next Friday');
$end->modify('next Friday'); $end->modify('next Friday');
/* $interval = \DateInterval::createFromDateString('1 day'); */ // should be using this but its bugged /* $interval = \DateInterval::createFromDateString('1 day'); */ // should be using this but its bugged
@ -488,7 +488,7 @@ class MasterFunctionsHelper {
// ->join('m_activity as a', 'a.id', '=', 'ama.activity_id') // ->join('m_activity as a', 'a.id', '=', 'ama.activity_id')
// ->max("plan_date"); // plan date overlapped with assign_material_to_activity's, it should be m_activity's // ->max("plan_date"); // plan date overlapped with assign_material_to_activity's, it should be m_activity's
$maxDate = $dataProject->akhir_proyek; $maxDate = $dataProject->akhir_proyek;
$end = new \DateTime($maxDate. ' Friday'); $end = new \DateTime($maxDate);
$end->modify('next Friday'); $end->modify('next Friday');
$end->modify('next Friday'); $end->modify('next Friday');
$interval = new \DateInterval('P7D'); $interval = new \DateInterval('P7D');

11
app/Models/HierarchyFtth.php

@ -14,4 +14,15 @@ class HierarchyFtth extends Model
protected $fillable = [ protected $fillable = [
'name', 'parent_id', 'project_id', 'created_at', 'updated_at', 'progress', 'bobot_planning' 'name', 'parent_id', 'project_id', 'created_at', 'updated_at', 'progress', 'bobot_planning'
]; ];
public static function boot() {
parent::boot();
static::deleted(function($data) {
$ftths = HierarchyFtth::where('parent_id', $data->id)->get();
foreach ($ftths as $ftth) {
$ftth->delete();
}
});
}
} }

Loading…
Cancel
Save