Browse Source

Merge pull request 'update endpoint' (#13) from dev-wahyun into staging

Reviewed-on: ibnu/generic-ospro-backend#13
pull/1/head
farhantock 11 months ago
parent
commit
52bf2f5594
  1. 37
      app/Http/Controllers/ProjectCarausellController.php

37
app/Http/Controllers/ProjectCarausellController.php

@ -16,34 +16,19 @@ class ProjectCarausellController extends Controller
$projectData = Project::query()
->select("id","nama","kode_sortname","pm_id","budget_health","calculation_status","mulai_proyek","akhir_proyek","rencana_biaya","company","scurve")
->get();
$arr = [];
foreach($projectData as $project) {
$projectRisk = ProjectRisks::query()
->select('proyek_id','description','level_risk','preventive_risk')
->get();
->where('proyek_id', $project['id'])
->get()
->toArray();
$projectIssue = ProjectIssues::query()
->select('proyek_id','description','level_issue')
->get();
$arr = [];
foreach($projectData as $project) {
$riskProject = [];
$issueProject = [];
foreach ($projectRisk as $risk) {
if ($risk['proyek_id'] === $project['id']) {
$riskProject[] = [
'level_risk' => $risk['level_risk'],
'preventive_risk' => $risk['preventive_risk'],
'description' => $risk['description']
];
}
}
foreach ($projectIssue as $issue) {
if ($issue['proyek_id'] === $project['id']) {
$issueProject[] = [
'level_issue' => $issue['level_issue'],
'description' => $issue['description']
];
}
}
->where('proyek_id',$project['id'])
->get()
->toArray();
$ganttData = VersionGantt::query()
->select('id', 'name_version','hierarchy_ftth_id','cost_to_complete','proyek_id','calculation_type')
->where('proyek_id',$project['id'])
@ -63,11 +48,9 @@ class ProjectCarausellController extends Controller
"rencana_biaya" => $project['rencana_biaya'],
"company" => $project['company'],
"scurve" => $project['scurve'],
"project_risk" => $riskProject,
"project_issues" => $issueProject
],
"project_manager" => $projectManager,
"project_risk" => $riskProject,
"project_risk" => $projectRisk,
"project_issue" => $projectIssue,
"gantt"=> $ganttData
];

Loading…
Cancel
Save