mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-22 14:52:41 +01:00
Export task point values as double, not int
Summary: See <https://discourse.phabricator-community.org/t/maniphest-non-integer-point-values-in-csv-export/1443>. We currently export the Maniphest "points" field as an integer, but allow it to accept decimal values (e.g. "6.25"). Also fix a bug where we wouldn't roll over from "..., X, Y, Z, AA, AB, ..." correctly for Excel column names if sheet had more than 26 columns. Test Plan: - Set a task point value to 6.25. - Exported to text, JSON, XLS. - Saw 6.25 represented accurately in exports. - Exported an excel sheet with 27+ columns. - Manually printed the first 200 column names to check that the algorithm looks correct. Reviewers: amckinley Reviewed By: amckinley Differential Revision: https://secure.phabricator.com/D19434
This commit is contained in:
parent
304c6a4597
commit
397645b273
4 changed files with 33 additions and 2 deletions
|
@ -2882,6 +2882,7 @@ phutil_register_library_map(array(
|
|||
'PhabricatorDocumentRef' => 'applications/files/document/PhabricatorDocumentRef.php',
|
||||
'PhabricatorDocumentRenderingEngine' => 'applications/files/document/render/PhabricatorDocumentRenderingEngine.php',
|
||||
'PhabricatorDoorkeeperApplication' => 'applications/doorkeeper/application/PhabricatorDoorkeeperApplication.php',
|
||||
'PhabricatorDoubleExportField' => 'infrastructure/export/field/PhabricatorDoubleExportField.php',
|
||||
'PhabricatorDraft' => 'applications/draft/storage/PhabricatorDraft.php',
|
||||
'PhabricatorDraftDAO' => 'applications/draft/storage/PhabricatorDraftDAO.php',
|
||||
'PhabricatorDraftEngine' => 'applications/transactions/draft/PhabricatorDraftEngine.php',
|
||||
|
@ -8540,6 +8541,7 @@ phutil_register_library_map(array(
|
|||
'PhabricatorDocumentRef' => 'Phobject',
|
||||
'PhabricatorDocumentRenderingEngine' => 'Phobject',
|
||||
'PhabricatorDoorkeeperApplication' => 'PhabricatorApplication',
|
||||
'PhabricatorDoubleExportField' => 'PhabricatorExportField',
|
||||
'PhabricatorDraft' => 'PhabricatorDraftDAO',
|
||||
'PhabricatorDraftDAO' => 'PhabricatorLiskDAO',
|
||||
'PhabricatorDraftEngine' => 'Phobject',
|
||||
|
|
|
@ -516,7 +516,7 @@ final class ManiphestTaskSearchEngine
|
|||
);
|
||||
|
||||
if (ManiphestTaskPoints::getIsEnabled()) {
|
||||
$fields[] = id(new PhabricatorIntExportField())
|
||||
$fields[] = id(new PhabricatorDoubleExportField())
|
||||
->setKey('points')
|
||||
->setLabel('Points');
|
||||
}
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
<?php
|
||||
|
||||
final class PhabricatorDoubleExportField
|
||||
extends PhabricatorExportField {
|
||||
|
||||
public function getNaturalValue($value) {
|
||||
if ($value === null) {
|
||||
return $value;
|
||||
}
|
||||
|
||||
return (double)$value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @phutil-external-symbol class PHPExcel_Cell_DataType
|
||||
*/
|
||||
public function formatPHPExcelCell($cell, $style) {
|
||||
$cell->setDataType(PHPExcel_Cell_DataType::TYPE_NUMERIC);
|
||||
}
|
||||
|
||||
public function getCharacterWidth() {
|
||||
return 8;
|
||||
}
|
||||
|
||||
}
|
|
@ -155,8 +155,12 @@ EOHELP
|
|||
return $this->sheet;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @phutil-external-symbol class PHPExcel_Cell
|
||||
*/
|
||||
private function getCellName($col, $row = null) {
|
||||
$col_name = chr(ord('A') + $col);
|
||||
$col_name = PHPExcel_Cell::stringFromColumnIndex($col);
|
||||
|
||||
if ($row === null) {
|
||||
return $col_name;
|
||||
|
|
Loading…
Reference in a new issue