Christopher Johnson (WMDE) has uploaded a new change for review.
https://gerrit.wikimedia.org/r/189189
Change subject: improved exception handling
......................................................................
improved exception handling
Change-Id: I01bb205a2598c0ce0d274c01f70f418b89794e93
---
M src/query/SprintQuery.php
M src/storage/BoardDataProvider.php
M src/view/SprintView.php
M src/view/burndown/SprintDataView.php
4 files changed, 29 insertions(+), 35 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/phabricator/extensions/Sprint
refs/changes/89/189189/1
diff --git a/src/query/SprintQuery.php b/src/query/SprintQuery.php
index b0c6561..5189f19 100644
--- a/src/query/SprintQuery.php
+++ b/src/query/SprintQuery.php
@@ -42,14 +42,29 @@
}
public function getStartDate($aux_fields) {
- $start = idx($aux_fields, 'isdc:sprint:startdate')
- ->getProxy()->getFieldValue();
- return $start;
+ $start = idx($aux_fields, 'isdc:sprint:startdate')
+ ->getProxy()->getFieldValue();
+ if (is_null($start)) {
+ $help = 'To do this, go to the Project Edit Details Page';
+ throw new BurndownException("The project \"".$this->project->getName()
+ ."\" is not set up for Sprint because "
+ ."it has not been assigned a start date\n", $help);
+ } else {
+ return $start;
+ }
}
public function getEndDate($aux_fields) {
$end = idx($aux_fields, 'isdc:sprint:enddate')
->getProxy()->getFieldValue();
+ if (is_null($end)) {
+ $help = 'To do this, go to the Project Edit Details Page';
+ throw new BurndownException("The project \"".$this->project->getName()
+ ."\" is not set up for Sprint because "
+ ."it has not been assigned an end date\n", $help);
+ } else {
+ return $end;
+ }
return $end;
}
@@ -59,7 +74,15 @@
->withAnyProjects(array($this->project->getPHID()))
->needProjectPHIDs(true)
->execute();
- return $tasks;
+ if (empty($tasks)) {
+ $help = "To Create a Task, go to the Sprint Board and select the "
+ ."column header menu";
+ throw new BurndownException("The project \"".$this->project->getName()
+ ."\" is not set up for Sprint because "
+ ."it has no tasks\n", $help);
+ } else {
+ return $tasks;
+ }
}
public function getStoryPointsForTask($task_phid) {
@@ -110,19 +133,6 @@
->withObjectPHIDs($task_phids)
->execute();
return $xactions;
- }
-
- public function checkNull($start, $end, $project, $tasks) {
- if (!$start OR !$end) {
- $projhelp = 'To do this go to the Project Edit Details Page';
- throw new BurndownException("The project \"".$project->getName()
- ."\" is not set up for Sprints because "
- ."it has not been assigned a start date and end date. \n",
$projhelp);
- }
- if (!$tasks) {
- $taskhelp = 'To add a task go to the Maniphest Query Page';
- throw new BurndownException('This project has no tasks.', $taskhelp);
- }
}
public function getXActionObj () {
diff --git a/src/storage/BoardDataProvider.php
b/src/storage/BoardDataProvider.php
index 690718e..3178185 100644
--- a/src/storage/BoardDataProvider.php
+++ b/src/storage/BoardDataProvider.php
@@ -145,9 +145,6 @@
public function buildChartfromBoardData() {
- $this->query->checkNull($this->start, $this->end, $this->project,
- $this->tasks);
-
$date_array = $this->stats->buildDateArray($this->start, $this->end,
$this->timezone);
$xactions = $this->getProjectColumnXactions();
diff --git a/src/view/SprintView.php b/src/view/SprintView.php
index 7144194..d1c143e 100644
--- a/src/view/SprintView.php
+++ b/src/view/SprintView.php
@@ -15,19 +15,6 @@
->setName('set_project')
->setValue($tokens));
- //if ($has_window) {
- // list($window_str, $ignored, $window_error) = $this->getWindow();
- // $form
- // ->appendChild(
- // id(new AphrontFormTextControl())
- // ->setLabel(pht('Recently Means'))
- // ->setName('set_window')
- // ->setCaption(
- // pht('Configure the cutoff for the "Recently Closed"
column.'))
- // ->setValue($window_str)
- // ->setError($window_error));
- // }
-
$form
->appendChild(
id(new AphrontFormSubmitControl())
diff --git a/src/view/burndown/SprintDataView.php
b/src/view/burndown/SprintDataView.php
index 599661e..f18d20b 100644
--- a/src/view/burndown/SprintDataView.php
+++ b/src/view/burndown/SprintDataView.php
@@ -36,10 +36,10 @@
->setViewer($this->viewer)
->setPHID($this->project->getPHID());
- $this->taskpoints = $query->getTaskData();
$tasks = $query->getTasks();
+ $this->taskpoints = $query->getTaskData();
$this->tasks = mpull($tasks, null, 'getPHID');
- $stats = id(new SprintBuildStats());
+ $stats = id(new SprintStats());
$this->setStartandEndDates($query);
$this->setTimezone($stats);
--
To view, visit https://gerrit.wikimedia.org/r/189189
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I01bb205a2598c0ce0d274c01f70f418b89794e93
Gerrit-PatchSet: 1
Gerrit-Project: phabricator/extensions/Sprint
Gerrit-Branch: master
Gerrit-Owner: Christopher Johnson (WMDE) <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits