public function show($id) { try { $iteration = Iterations::findOrFail($id); $iterations = Iterations::where('projectid', '=', $iteration->projectid)->get(); $project = Project::findOrFail($iteration->projectid); $issues = Issue::where('iterationid', '=', $id)->get(); //$issues = $iteration->issues; $countIssues = sizeof($issues); $categories = Category::all(); $idCategory = 0; $totalPoints = $issues->sum('points'); $materiales = Material::all(); $personal = PersonalType::all(); $team = Teams::where('projectid', '=', $project->id)->get()->first(); $members = DB::table('memberof')->where('teamid', '=', $team->id)->get(); $hasmembers = sizeof($members) > 0 ? true : false; $users = array(); foreach ($members as $member) { $users[] = User::findOrFail($member->usersid); echo $hasmembers; } $this->layout->content = View::make('layouts.iterations.show')->with('iteration', $iteration)->with('iterations', $iterations)->with('issues', $issues)->with('categories', $categories)->with('idCategory', $idCategory)->with('countIssues', $countIssues)->with('totalPoints', $totalPoints)->with('project', $project)->with('materiales', $materiales)->with('personal', $personal)->with('hasmembers', $hasmembers)->with('members', $members)->with('users', $users)->with('message', ''); } catch (Illuminate\Database\Eloquent\ModelNotFoundException $e) { return Redirect::to('/projects/')->with('message', 'Error al crear la iteración'); } }
$totalPersonal += $total; $task->typePersonal()->attach([$id => ['quantity' => $cantidad, 'hours' => $hours, 'total' => $total]]); } } //obtener los gastos adicionales de la tarea $gastos = AdditionalCost::where('taskid', '=', $id)->get(); $totalSpent = 0; if (count($gastos) > 0) { foreach ($gastos as $gasto) { $totalSpent += $gasto->total; } } //actualizar la iteracion y el proyecto $totalTask = $totalMaterial + $totalPersonal + $totalSpent; $issue = Issue::findOrFail($task->issueid); $iteration = Iterations::findOrFail($issue->iterationid); $project = Project::findOrFail($iteration->projectid); //iteracion $iteration->realBudget = $iteration->realBudget + $totalTask; $iteration->save(); //proyecto $project->budgetReal = $project->budgetReal + $totalTask; $project->save(); $final = "yes"; //actualizar a finalizado la tarea $task->closed = 'SI'; $task->save(); } $user = User::findOrFail($task->userid); return Response::json(array('succes' => '1', 'task' => $task, 'user' => $user, 'final' => $final)); }
public function searchIssues($id) { $iteration = Iterations::findOrFail($id); $aux = Issue::where('iterationid', '=', $id)->get(); return $aux; }
public function iterationSummary2($id) { $iteration = Iterations::findOrFail($id); $issues = Issue::where('iterationid', '=', $iteration->id)->get(); $tasksId = array(); foreach ($issues as $issue) { $tasksId[] = $issue->id; } $tasks = Task::whereIn('issueid', $tasksId)->get(); $countTODO = 0; $countDOING = 0; $countDONE = 0; foreach ($tasks as $task) { switch ($task->scrumid) { case 1: $countTODO++; break; case 2: $countDOING++; break; case 3: $countDONE++; break; } } }