Skip to content
Snippets Groups Projects
Commit 1ad9053e authored by Daniel Stone's avatar Daniel Stone
Browse files

Remove unnecessary story-points field


For some reason, despite using Maniphest's built-in story-points field,
the extension continued to provide its own, which resulted in duplicate
fields showing in the UI.

Remove it, and all remenants of code using it, to avoid confusion.

Signed-off-by: Daniel Stone's avatarDaniel Stone <daniels@collabora.com>

Differential Revision: https://phabricator.collabora.co.uk/D483
parent ac672edf
No related branches found
No related tags found
No related merge requests found
...@@ -69,7 +69,6 @@ phutil_register_library_map(array( ...@@ -69,7 +69,6 @@ phutil_register_library_map(array(
'SprintStats' => 'storage/SprintStats.php', 'SprintStats' => 'storage/SprintStats.php',
'SprintStatsTest' => 'tests/SprintStatsTest.php', 'SprintStatsTest' => 'tests/SprintStatsTest.php',
'SprintTableView' => 'view/SprintTableView.php', 'SprintTableView' => 'view/SprintTableView.php',
'SprintTaskStoryPointsField' => 'customfield/SprintTaskStoryPointsField.php',
'SprintTestCase' => 'tests/SprintTestCase.php', 'SprintTestCase' => 'tests/SprintTestCase.php',
'SprintUIObjectBoxView' => 'view/SprintUIObjectBoxView.php', 'SprintUIObjectBoxView' => 'view/SprintUIObjectBoxView.php',
'SprintValidator' => 'util/SprintValidator.php', 'SprintValidator' => 'util/SprintValidator.php',
...@@ -135,10 +134,6 @@ phutil_register_library_map(array( ...@@ -135,10 +134,6 @@ phutil_register_library_map(array(
'SprintSetStartEndDatesConduitAPIMethod' => 'SprintConduitAPIMethod', 'SprintSetStartEndDatesConduitAPIMethod' => 'SprintConduitAPIMethod',
'SprintStatsTest' => 'SprintTestCase', 'SprintStatsTest' => 'SprintTestCase',
'SprintTableView' => 'AphrontView', 'SprintTableView' => 'AphrontView',
'SprintTaskStoryPointsField' => array(
'ManiphestCustomField',
'PhabricatorStandardCustomFieldInterface',
),
'SprintTestCase' => 'PHPUnit_Framework_TestCase', 'SprintTestCase' => 'PHPUnit_Framework_TestCase',
'SprintUIObjectBoxView' => 'AphrontView', 'SprintUIObjectBoxView' => 'AphrontView',
'SprintValidator' => 'Phobject', 'SprintValidator' => 'Phobject',
... ...
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
final class SprintConstants { final class SprintConstants {
const POINTFIELD_INDEX = 'yERhvoZPNPtM';
const SPRINTFIELD_INDEX = 'scsOmkpB9Tqi'; const SPRINTFIELD_INDEX = 'scsOmkpB9Tqi';
const PANEL_BURNDOWN = 'project.sprint'; const PANEL_BURNDOWN = 'project.sprint';
const PANEL_PHRAGILE = 'project.phragile'; const PANEL_PHRAGILE = 'project.phragile';
... ...
......
<?php
/**
* @author Michael Peters
* @author Christopher Johnson
* @license GPL version 3
*/
final class SprintTaskStoryPointsField extends ManiphestCustomField
implements
PhabricatorStandardCustomFieldInterface {
private $obj;
private $textproxy;
public function __construct() {
$this->obj = clone $this;
$this->textproxy = id(new PhabricatorStandardCustomFieldInt())
->setFieldKey($this->getFieldKey())
->setApplicationField($this->obj)
->setFieldConfig(array(
'name' => $this->getFieldName(),
'description' => $this->getFieldDescription(),
));
$this->setProxy($this->textproxy);
}
public function canSetProxy() {
return true;
}
public function getFieldKey() {
return 'isdc:sprint:storypoints';
}
public function getModernFieldKey() {
return 'storypoints';
}
public function getFieldName() {
return 'Story Points';
}
public function getFieldDescription() {
return 'Estimated story points for this task';
}
public function getStandardCustomFieldNamespace() {
return 'maniphest';
}
public function showField() {
static $show = null;
$viewer = $this->getViewer();
if ($show == null) {
if ($this->getObject() instanceof ManiphestTask) {
$id = $this->getObject()->getID();
if ($id) {
$task = id(new ManiphestTaskQuery())
->setViewer($viewer)
->withIds(array($id))
->needProjectPHIDs(true)
->executeOne();
$projectphids = $task->getProjectPHIDs();
}
}
if (empty($projectphids)) {
return $show = false;
}
$show = false;
foreach ($projectphids as $projectphid) {
if ($this->isSprint($projectphid)) {
$show = true;
break;
}
}
}
return $show;
}
public function renderPropertyViewLabel() {
if ($this->showField() === true) {
if ($this->textproxy) {
return $this->textproxy->renderPropertyViewLabel();
}
return $this->getFieldName();
}
}
public function renderPropertyViewValue(array $handles) {
if ($this->showField() === true) {
if ($this->textproxy) {
return $this->textproxy->renderPropertyViewValue($handles);
}
throw new PhabricatorCustomFieldImplementationIncompleteException($this);
}
}
public function shouldAppearInEditView() {
return true;
}
public function renderEditControl(array $handles) {
if ($this->showField() === true) {
if ($this->textproxy) {
return $this->textproxy->renderEditControl($handles);
}
throw new PhabricatorCustomFieldImplementationIncompleteException($this);
}
}
// == Search
public function shouldAppearInApplicationSearch() {
return true;
}
protected function isSprint($projectphid) {
$validator = new SprintValidator();
$issprint = call_user_func(array($validator, 'checkForSprint'),
array($validator, 'isSprint'), $projectphid);
return $issprint;
}
}
...@@ -103,21 +103,6 @@ final class SprintQuery extends SprintDAO { ...@@ -103,21 +103,6 @@ final class SprintQuery extends SprintDAO {
return $tasks; return $tasks;
} }
public function getStoryPointsForTask($task_phid) {
$points = null;
$object = new ManiphestCustomFieldStorage();
$corecustomfield = $object->loadRawDataWhere('objectPHID= %s AND
fieldIndex=%s', $task_phid, SprintConstants::POINTFIELD_INDEX);
if (!empty($corecustomfield)) {
foreach ($corecustomfield as $array) {
$points = idx($array, 'fieldValue');
}
} else {
$points = 0;
}
return $points;
}
public function getIsSprint() { public function getIsSprint() {
$issprint = null; $issprint = null;
$object = new PhabricatorProjectCustomFieldStorage(); $object = new PhabricatorProjectCustomFieldStorage();
...@@ -242,20 +227,6 @@ final class SprintQuery extends SprintDAO { ...@@ -242,20 +227,6 @@ final class SprintQuery extends SprintDAO {
return $data; return $data;
} }
public function getTaskData() {
$task_dao = new ManiphestCustomFieldStorage();
$data = queryfx_all(
$this->getCustomFieldConn(),
'SELECT f.* FROM %T f %Q
WHERE fieldIndex = %s',
$this->getCustomFieldObj()->getTableName(),
$this->getCustomFieldJoins(),
SprintConstants::POINTFIELD_INDEX);
$task_data = $task_dao->loadAllFromArray($data);
return $task_data;
}
public function getEdges($tasks) { public function getEdges($tasks) {
// Load all edges of depends and depended on tasks // Load all edges of depends and depended on tasks
$edges = id(new PhabricatorEdgeQuery()) $edges = id(new PhabricatorEdgeQuery())
... ...
......
...@@ -20,24 +20,6 @@ final class SprintCustomFieldTest extends SprintTestCase { ...@@ -20,24 +20,6 @@ final class SprintCustomFieldTest extends SprintTestCase {
$this->assertEquals($fieldname, 'When a sprint starts'); $this->assertEquals($fieldname, 'When a sprint starts');
} }
public function testgetStoryPointsFieldName() {
$subclassname = new SprintTaskStoryPointsField();
$fieldname = $subclassname->getFieldName();
$this->assertEquals($fieldname, 'Story Points');
}
public function testgetStoryPointsFieldKey() {
$subclassname = new SprintTaskStoryPointsField();
$fieldname = $subclassname->getFieldKey();
$this->assertEquals($fieldname, 'isdc:sprint:storypoints');
}
public function testgetStoryPointsFieldDescription() {
$subclassname = new SprintTaskStoryPointsField();
$fieldname = $subclassname->getFieldDescription();
$this->assertEquals($fieldname, 'Estimated story points for this task');
}
public function testgetEndFieldName() { public function testgetEndFieldName() {
$subclassname = new SprintEndDateField(); $subclassname = new SprintEndDateField();
$fieldname = $subclassname->getFieldName(); $fieldname = $subclassname->getFieldName();
... ...
......
...@@ -8,7 +8,6 @@ final class SprintDataView extends SprintView { ...@@ -8,7 +8,6 @@ final class SprintDataView extends SprintView {
private $project; private $project;
private $viewer; private $viewer;
private $tasks; private $tasks;
private $taskpoints;
private $events; private $events;
private $start; private $start;
private $end; private $end;
...@@ -36,7 +35,6 @@ final class SprintDataView extends SprintView { ...@@ -36,7 +35,6 @@ final class SprintDataView extends SprintView {
->setPHID($this->project->getPHID()); ->setPHID($this->project->getPHID());
$tasks = $query->getTasks(); $tasks = $query->getTasks();
$this->taskpoints = $query->getTaskData();
$this->tasks = mpull($tasks, null, 'getPHID'); $this->tasks = mpull($tasks, null, 'getPHID');
$stats = id(new SprintStats()); $stats = id(new SprintStats());
... ...
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment