Esempio n. 1
0
 public function testUpdate()
 {
     $sprint1 = Sprint::create(['StartDate' => '2015-11-10', 'EndDate' => '2015-11-16', 'project_id' => '1']);
     ${$sprint1}->update(['StartDate' => '2015-11-17', 'EndDate' => '2015-11-25', 'project_id' => '1']);
     $this->assertEquals('2015-11-10', $sprint1->StartDate);
     $this->assertEquals('2015-11-16', $sprint1->EndDate);
     $this->assertEquals(1, Tache::all()->count());
 }
Esempio n. 2
0
 /**
  * Set the status of a sprint to complete, if all issues in this sprint are complete
  * @param  Request
  * @return array $result
  */
 public function complete(Request $request)
 {
     // default
     $result = array('message' => 'There was an error processing this request', 'status' => 0);
     $sprintName = $request->sprintMachineName;
     $projectId = $request->projectId;
     $sprint = Sprint::where('machine_name', '=', $sprintName)->where('project_id', '=', $projectId)->firstOrFail();
     if ($sprint && $sprint->isComplete()) {
         $sprint->status_id = SprintStatus::getIdByMachineName('complete');
         $sprint->save();
         $result = array('message' => 'This sprint has been set to complete', 'sprintMachineName' => $sprintName, 'status' => 1);
     } else {
         $result = array('message' => 'All issues in the sprint should be complete or archived before setting a sprint to complete', 'sprintMachineName' => $sprintName, 'status' => 0);
     }
     return $result;
 }
Esempio n. 3
0
 /**
  * sortorder Set sort order (sort_prev and sort_next) for an issue when its dragged and dropped into
  * the same sprint
  * @return $result array
  */
 public function sortorder()
 {
     $result = "There was an error updating the issue's sort order";
     $issueId = (int) trim(Request::get('issueId'));
     $projectId = (int) trim(Request::get('projectId'));
     if (Request::get('newPrevIssueId')) {
         $newPrevIssueIdInSprint = trim(strip_tags(Request::get('newPrevIssueId')));
     } else {
         $newPrevIssueIdInSprint = NULL;
     }
     if (Request::get('newNextIssueId')) {
         $newNextIssueIdInSprint = trim(strip_tags(Request::get('newNextIssueId')));
     } else {
         $newNextIssueIdInSprint = NULL;
     }
     // @todo check if the above prev. and next issues are actually in the same sprint as issue
     $issue = Issue::findOrFail($issueId);
     // Update sort order for current previous and next issues in the sprint
     $currentPrevIssue = Sprint::findOrFail($issue->sprint_id)->getPreviousIssueBySortOrder($issueId);
     $currentNextIssue = Sprint::findOrFail($issue->sprint_id)->getNextIssueBySortOrder($issueId);
     if ($currentPrevIssue) {
         $currentPrevIssue->sort_next = $issue->sort_next ? $issue->sort_next : NULL;
         $currentPrevIssue->save();
     }
     if ($currentNextIssue) {
         $currentNextIssue->sort_prev = $issue->sort_prev ? $issue->sort_prev : NULL;
         $currentNextIssue->save();
     }
     // Update sort order for new previous and next issues in the sprint
     if ($newPrevIssueIdInSprint) {
         $newPrevIssue = Issue::findOrFail($newPrevIssueIdInSprint);
         $newPrevIssue->sort_next = $issueId;
         $newPrevIssue->save();
     }
     if ($newNextIssueIdInSprint) {
         $newNextIssue = Issue::findOrFail($newNextIssueIdInSprint);
         $newNextIssue->sort_prev = $issueId;
         $newNextIssue->save();
     }
     // Update sort previous and next for issue
     DB::update('update issues set sort_prev = ?, sort_next = ? where id = ?', [$newPrevIssueIdInSprint, $newNextIssueIdInSprint, $issueId]);
     $result = "Issue's sort order has been updated successfully.";
     return $result;
 }
Esempio n. 4
0
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function show($id)
 {
     $userstories = Userstory::all();
     $selectedUserStories = array();
     $i = 0;
     foreach ($userstories as $userstory) {
         if ($userstory->project_id == $id) {
             $selectedUserStories[$i] = $userstory;
             $i++;
         }
     }
     $sprints = Sprint::all();
     $realisedUS = array();
     $somme = 0;
     for ($i = 0; $i < count($selectedUserStories); $i++) {
         $somme = $somme + $selectedUserStories[$i]->difficulty;
     }
     $cptt = 0;
     $cpt = $somme;
     foreach ($sprints as $sprint) {
         for ($i = 0; $i < count($selectedUserStories); $i++) {
             if ($selectedUserStories[$i]->sprint_id == $sprint->id && $selectedUserStories[$i]->status == 1) {
                 $cptt = $cptt + $selectedUserStories[$i]->difficulty;
             }
         }
         $realisedUS[$sprint->id] = $cpt - $cptt;
     }
     //dd($realisedUS);
     $j = 1;
     $userstori = array();
     $time = array();
     $userstori[0] = $somme;
     $time[0] = 0;
     //dd($realisedUS);
     foreach ($realisedUS as $key => $value) {
         $userstori[$j] = $value;
         $time[$j] = $key;
         $j++;
     }
     //dd($time);
     //$userstori[0] = count($selectedUserStories);
     JpGraph::load();
     JpGraph::module('line');
     //$time = array_keys($realisedUS);
     //dd($realisedUS);
     //dd($time);
     //dd($userstori);
     $graph = new \Graph(900, 300);
     $ydata = $userstori;
     $xdata = $time;
     //dd($time);
     //dd($userstori);
     $graph->SetScale('intint');
     $lineplot = new \LinePlot($ydata, $xdata);
     $lineplot->SetColor('forestgreen');
     $graph->Add($lineplot);
     $graph->title->Set('BurnDownChart');
     $graph->xaxis->title->Set('Sprint\'s Time');
     $graph->yaxis->title->Set('Difficulties');
     $lineplot->SetWeight(3);
     $gdImgHandler = $graph->Stroke(_IMG_HANDLER);
     //Start buffering
     ob_start();
     //Print the data stream to the buffer
     $graph->img->Stream();
     //Get the contents of the buffer
     $image_data = ob_get_contents();
     //Stop the buffer/clear it.
     ob_end_clean();
     //Set the variable equal to the base 64 encoded value of the stream.
     //This gets passed to the browser and displayed.
     $image = base64_encode($image_data);
     return view('bdchart.index', compact('realisedUS', 'id', 'data', 'texte', 'image'));
 }
Esempio n. 5
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy(Project $project, Sprint $sprint)
 {
     $sprint->delete();
     return response()->json(['status' => 'success']);
 }
Esempio n. 6
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit($id)
 {
     $sprints = Sprint::lists('id', 'id');
     $us_stories = Userstory::lists('description', 'id');
     $tache = Tache::findOrNew($id);
     $predecessors = Tache::lists('code', 'code');
     return view('taches.edit', compact('tache', 'sprints', 'us_stories', 'predecessors'));
 }
Esempio n. 7
0
 /**
  * Update the sprint associated with an issue
  * @todo create a function to get sprint machine names for a given project
  */
 public function sprintchange()
 {
     $result = "There was an error updating the issue's sprint association";
     $issueId = (int) trim(Request::get('issueId'));
     $projectId = (int) trim(Request::get('projectId'));
     $issue = Issue::find($issueId);
     $machineNameOfNewSprint = trim(strip_tags(Request::get('machineNameOfNewSprint')));
     $sprints = Project::find($issue->project_id)->getSprints();
     $sprintMachineNames = [];
     foreach ($sprints as $sprint) {
         array_push($sprintMachineNames, $sprint->machine_name);
     }
     if (in_array($machineNameOfNewSprint, $sprintMachineNames)) {
         $sprintId = (int) Sprint::where('machine_name', '=', $machineNameOfNewSprint)->where('project_id', '=', $projectId)->first()->id;
         DB::update('update issues set sprint_id = ? where id = ?', [$sprintId, $issueId]);
         $result = "Issue's sprint association has been updated successfully.";
     }
     return $result;
 }
Esempio n. 8
0
 public function editConfirm(NewSprintRequest $r, $project_id, $sprint_id)
 {
     $us = Sprint::where('id', $sprint_id)->first();
     $us->update(["StartDate" => $r->input("StartDate"), "EndDate" => $r->input("EndDate")]);
     return Redirect::action("SprintController@listSprint", [$project_id]);
 }
Esempio n. 9
0
 /**
  * createBacklogSprint when a new project is created, 
  * create a sprint named backlog by default and set its status to inactive
  * @param  int $projectId
  */
 public function createBacklogSprint($projectId)
 {
     if ($projectId) {
         $sprint = new Sprint();
         $sprint->name = 'Backlog';
         $sprint->machine_name = 'backlog';
         $sprint->status_id = SprintStatus::getIdByMachineName('inactive');
         $sprint->project_id = (int) $projectId;
         $sprint->sort_order = 0;
         $sprint->save();
     }
 }
Esempio n. 10
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy(Project $project, Backlog $backlog, Sprint $sprint)
 {
     $sprint->delete();
     event(new FeedableEvent('SprintDeleted', $user, $sprint, $project));
     return response()->json(['status' => 'success', 'Message' => 'Sprint deleted.']);
 }
Esempio n. 11
0
 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update(Project $project, Sprint $sprint, Collection $stories)
 {
     $sprint->stories()->saveMany($stories->all());
     return response()->json(['status' => 'success', 'message' => 'Stories added to sprint.', 'stories' => $stories]);
 }