コード例 #1
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;
 }
コード例 #2
0
ファイル: Project.php プロジェクト: jneto81/Scrumwala
 /**
  * Get the active sprint for a given project
  * @return first sprint from collection
  */
 public function getActiveSprint()
 {
     return $this->sprints()->where('status_id', '=', SprintStatus::getIdByMachineName('active'))->get()->first();
 }