Browse Source

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

Reviewed-on: ordo/adw-backend#105
pull/3/head
ibnu 1 year ago
parent
commit
474bc02d3f
  1. 2
      app/Console/Commands/CalculateSCurve.php
  2. 6
      app/Helpers/MasterFunctionsHelper.php
  3. 2
      app/Http/Controllers/ActivityController.php
  4. 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->calculation_status = true;
$project->save();
return $data;
}
}

6
app/Helpers/MasterFunctionsHelper.php

@ -473,11 +473,11 @@ class MasterFunctionsHelper {
$minDate = $dataProject->mulai_proyek;
$begin = new \DateTime($minDate.' Monday');
$begin = new \DateTime($minDate);
$begin->modify('last Monday');
if(isset($dataPayload['end_date'])){
$maxDate = $dataPayload['end_date'];
$end = new \DateTime($maxDate. ' Friday');
$end = new \DateTime($maxDate);
$end->modify('next Friday');
$end->modify('next Friday');
/* $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')
// ->max("plan_date"); // plan date overlapped with assign_material_to_activity's, it should be m_activity's
$maxDate = $dataProject->akhir_proyek;
$end = new \DateTime($maxDate. ' Friday');
$end = new \DateTime($maxDate);
$end->modify('next Friday');
$end->modify('next Friday');
$interval = new \DateInterval('P7D');

2
app/Http/Controllers/ActivityController.php

@ -399,7 +399,7 @@ class ActivityController extends Controller
}
$projectStart = Project::select('mulai_proyek')->where('id', $projectId)->first();
foreach ($data['activities'] as $i => $activity_row) {
$startDate = \DateTime::createFromFormat('Y-m-d H:i:s.uP', $projectStart->mulai_proyek);
$startDate = new \DateTime($projectStart->mulai_proyek);
$endDate = clone $startDate;
$endDate->modify('-1 day');
$daysRemaining = $activity_row['duration'];

11
app/Models/HierarchyFtth.php

@ -14,4 +14,15 @@ class HierarchyFtth extends Model
protected $fillable = [
'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