Alan Moment
  • Introduction
  • 智慧家庭
    • Fibaro 系統整合便宜的 IP Cam
  • Life
    • 用AWS Glacier做最後的冷資料備份
    • 如何在macOS修改影音檔日期
  • 3D Printer
    • Atom2.5EX 之血淚組裝
    • 列印經驗紀錄
      • SpoolHolder
    • 製圖經驗
      • Turntable
      • 重製Atom3散熱風扇
    • 線材經驗
      • PETG
        • 首測
  • Kubernetes
    • 使用Kops建立Kubernetes
    • 使用HelmV2
    • Kubernetes的技術問題排解技巧
  • PHP
    • 管理PHP Library的利器Composer
    • PHP安裝JSON
    • Phalcon首發
    • Gearman Job Worker for PHP
    • Laravel 首發 !!!
    • Data Encrypt & Decrypt
  • Python
    • Django + Python 開發環境建置
  • Android
    • Android zipcode library of maven
    • Android use foreign object of OrmLite
    • ProgressBar while loading ListView of Android
    • AsyncTask download image by the Android
    • Use Thread control Android UI
    • Android Universal Image Loader
  • Ruby on Rails
    • Install rmagick on the Windows of Ruby on Rails
    • Ruby on Rails deploy on Heroku
    • Ruby on Rails 小問題
  • React
    • Ditched AngularJS for React
  • Tessel
    • 很潮的 Tessel
    • Connect to Slack on Tessel
    • Baby Help on Tessel
  • Node.js
    • CentOS 安装 Node.js 0.8.5
  • OOAD
    • Injection Principle Design Pattern
  • Linux
    • SSH免密碼登入遠端電腦
    • Apache與Tomcat的結合
    • The bash auto build
  • Hadoop
    • CentOS 5.5 + Hadoop 0.20
    • CentOS 5.5 + Hbase 0.94.8
    • Hadoop + Hbase 叢集環境
    • Hadoop 溝通橋梁之 Thrift 0.7
    • 使用MapReduce之替代方案Hive
    • 使用Sqoop將MySQL資料匯入Hbase
  • Database
    • 吃足苦頭的Mssql
  • IDE
    • Netbeans console中文亂碼解決方法
    • 用NetBeans開發Ruby On Rails
  • Agile
    • 淺談我的Agile
  • 協作工具
    • 建置專屬自己的Github之Gitlab
    • Gitlab 4.1 upgrade to Gitlab 6.0超偷懶方法
    • Install Phabricator and run on the Gitlab
    • Phabricator 基本應用
    • Phabricator review code應用
    • Redmine之基本建置與Scrum應用
    • Omnibus Gitlab 7 基礎操作
    • Git Push Notify to Slack on Gitlab
    • phabricator-extensions-Sprint 無法抓到正確的 Story Points
  • 其他
    • 慶祝Octopress開張
    • 走在時尚的尖端! Ghost
    • 大搬家
    • 網頁教學初體驗
    • 網路攻擊很猖狂
Powered by GitBook
On this page
  • 複製 copy_points.php
  • 更改權限
  • 執行

Was this helpful?

  1. 協作工具

phabricator-extensions-Sprint 無法抓到正確的 Story Points

PreviousGit Push Notify to Slack on GitlabNext其他

Last updated 3 years ago

Was this helpful?

在版號為 741e2ef4b1150f9a9e4b121218b3ea536289968d 之後的版本,因為 story points 變更欄位,所以 burndown chart 會沒辦法抓到正確的 point。

可以在這邊找到答案,但是並不是環境都一樣,所以必須要調整一下。

複製 copy_points.php

將複製到 phabricator 目錄底下,如果你的資料庫名稱不是 phabricator_maniphest,那就要修改,第 106 行,如我就修改為 default_maniphest

#!/usr/bin/env php
<?php // See <https://secure.phabricator.com/T10350> for discussion.

require_once 'scripts/__init_script__.php';

$args = new PhutilArgumentParser($argv);
$args->parseStandardArguments();
$args->parse(
  array(
    array(
      'name'  => 'field',
      'param' => 'key',
      'help'  => pht('Field to migrate.'),
    )
  ));

$task = new ManiphestTask();
$fields = PhabricatorCustomField::getObjectFields(
  $task,
  PhabricatorCustomField::ROLE_EDIT);

$field_map = $fields->getFields();
$field_list = implode(', ', array_keys($field_map));

if (!$field_map) {
  throw new PhutilArgumentUsageException(
    pht(
      'You do not have any custom fields defined in Maniphest, so there is '.
      'nowhere that points can be copied from.'));
}

$field_key = $args->getArg('field');
if (!strlen($field_key)) {
  throw new PhutilArgumentUsageException(
    pht(
      'Use --field to specify which field to copy points from. Available '.
      'fields are: %s.',
      $field_list));
}

$field = idx($field_map, $field_key);
if (!$field) {
  throw new PhutilArgumentUsageException(
    pht(
      'Field "%s" is not a valid field. Available fields are: %s.',
      $field_key,
      $field_list));
}

$proxy = $field->getProxy();
if (!$proxy) {
  throw new PhutilArgumentUsageException(
    pht(
      'Field "%s" is not a standard custom field, and can not be migrated.',
      $field_key,
      $field_list));
}

if (!($proxy instanceof PhabricatorStandardCustomFieldInt)) {
  throw new PhutilArgumentUsageException(
    pht(
      'Field "%s" is not an "int" field, and can not be migrated.',
      $field_key,
      $field_list));
}

$storage = $field->newStorageObject();
$conn_r = $storage->establishConnection('r');

$value_rows = queryfx_all(
  $conn_r,
  'SELECT objectPHID, fieldValue FROM %T WHERE fieldIndex = %s
    AND fieldValue IS NOT NULL',
  $storage->getTableName(),
  $field->getFieldIndex());
$value_map = ipull($value_rows, 'fieldValue', 'objectPHID');

$id_rows = queryfx_all(
  $conn_r,
  'SELECT phid, id, points FROM %T',
  $task->getTableName());
$id_map = ipull($id_rows, null, 'phid');

foreach ($value_map as $phid => $value) {
  $dict = idx($id_map, $phid, array());
  $id = idx($dict, 'id');
  $current_points = idx($dict, 'points');

  if (!$id) {
    continue;
  }

  if ($current_points !== null) {
    continue;
  }

  if ($value === null) {
    continue;
  }

  $sql = qsprintf(
    $conn_r,
    'UPDATE %T.%T SET points = %f WHERE id = %d;',
    'phabricator_maniphest',
    $task->getTableName(),
    $value,
    $id);

  echo $sql."\n";
}

更改權限

chmod +x copy_points.php

執行

另外要注意自己之前輸入 story points 時是否有用到非數字的字元,有的話會出錯,得先去修改。可以在 default_maniphest.maniphest_customfieldstorage 這張資料表去查看。

./copy_points.php --field isdc:sprint:storypoints > points.sql
cat points.sql # Look at the results and sanity check them.
cat points.sql | mysql -u root

必須要去套件原始檔去看原始的 欄位是什麼,我查到的結果是 isdc:sprint:storypoints,所以修改如下。

官方
檔案
story point