diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index 95c5059d06..e8c0392427 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -4422,6 +4422,7 @@ phutil_register_library_map(array( 'PhabricatorProjectsWatchersSearchEngineAttachment' => 'applications/project/engineextension/PhabricatorProjectsWatchersSearchEngineAttachment.php', 'PhabricatorPronounSetting' => 'applications/settings/setting/PhabricatorPronounSetting.php', 'PhabricatorProtocolLog' => 'infrastructure/log/PhabricatorProtocolLog.php', + 'PhabricatorPureChartFunction' => 'applications/fact/chart/PhabricatorPureChartFunction.php', 'PhabricatorPygmentSetupCheck' => 'applications/config/check/PhabricatorPygmentSetupCheck.php', 'PhabricatorQuery' => 'infrastructure/query/PhabricatorQuery.php', 'PhabricatorQueryConstraint' => 'infrastructure/query/constraint/PhabricatorQueryConstraint.php', @@ -9155,7 +9156,7 @@ phutil_register_library_map(array( 'PhabricatorConpherenceWidgetVisibleSetting' => 'PhabricatorInternalSetting', 'PhabricatorConsoleApplication' => 'PhabricatorApplication', 'PhabricatorConsoleContentSource' => 'PhabricatorContentSource', - 'PhabricatorConstantChartFunction' => 'PhabricatorChartFunction', + 'PhabricatorConstantChartFunction' => 'PhabricatorPureChartFunction', 'PhabricatorContactNumbersSettingsPanel' => 'PhabricatorSettingsPanel', 'PhabricatorContentSource' => 'Phobject', 'PhabricatorContentSourceModule' => 'PhabricatorConfigModule', @@ -9167,7 +9168,7 @@ phutil_register_library_map(array( 'PhabricatorCoreCreateTransaction' => 'PhabricatorCoreTransactionType', 'PhabricatorCoreTransactionType' => 'PhabricatorModularTransactionType', 'PhabricatorCoreVoidTransaction' => 'PhabricatorModularTransactionType', - 'PhabricatorCosChartFunction' => 'PhabricatorChartFunction', + 'PhabricatorCosChartFunction' => 'PhabricatorPureChartFunction', 'PhabricatorCountFact' => 'PhabricatorFact', 'PhabricatorCountdown' => array( 'PhabricatorCountdownDAO', @@ -10068,7 +10069,7 @@ phutil_register_library_map(array( 'PhabricatorMarkupInterface', ), 'PhabricatorMarkupPreviewController' => 'PhabricatorController', - 'PhabricatorMaxChartFunction' => 'PhabricatorChartFunction', + 'PhabricatorMaxChartFunction' => 'PhabricatorPureChartFunction', 'PhabricatorMemeEngine' => 'Phobject', 'PhabricatorMemeRemarkupRule' => 'PhutilRemarkupRule', 'PhabricatorMentionRemarkupRule' => 'PhutilRemarkupRule', @@ -10135,7 +10136,7 @@ phutil_register_library_map(array( 'PhabricatorMetronome' => 'Phobject', 'PhabricatorMetronomeTestCase' => 'PhabricatorTestCase', 'PhabricatorMetronomicTriggerClock' => 'PhabricatorTriggerClock', - 'PhabricatorMinChartFunction' => 'PhabricatorChartFunction', + 'PhabricatorMinChartFunction' => 'PhabricatorPureChartFunction', 'PhabricatorModularTransaction' => 'PhabricatorApplicationTransaction', 'PhabricatorModularTransactionType' => 'Phobject', 'PhabricatorMonogramDatasourceEngineExtension' => 'PhabricatorDatasourceEngineExtension', @@ -10950,6 +10951,7 @@ phutil_register_library_map(array( 'PhabricatorProjectsWatchersSearchEngineAttachment' => 'PhabricatorSearchEngineAttachment', 'PhabricatorPronounSetting' => 'PhabricatorSelectSetting', 'PhabricatorProtocolLog' => 'Phobject', + 'PhabricatorPureChartFunction' => 'PhabricatorChartFunction', 'PhabricatorPygmentSetupCheck' => 'PhabricatorSetupCheck', 'PhabricatorQuery' => 'Phobject', 'PhabricatorQueryConstraint' => 'Phobject', @@ -11208,7 +11210,7 @@ phutil_register_library_map(array( 'PhabricatorPolicyInterface', ), 'PhabricatorSavedQueryQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', - 'PhabricatorScaleChartFunction' => 'PhabricatorChartFunction', + 'PhabricatorScaleChartFunction' => 'PhabricatorPureChartFunction', 'PhabricatorScheduleTaskTriggerAction' => 'PhabricatorTriggerAction', 'PhabricatorScopedEnv' => 'Phobject', 'PhabricatorSearchAbstractDocument' => 'Phobject', @@ -11299,12 +11301,12 @@ phutil_register_library_map(array( 'PhabricatorSetupIssue' => 'Phobject', 'PhabricatorSetupIssueUIExample' => 'PhabricatorUIExample', 'PhabricatorSetupIssueView' => 'AphrontView', - 'PhabricatorShiftChartFunction' => 'PhabricatorChartFunction', + 'PhabricatorShiftChartFunction' => 'PhabricatorPureChartFunction', 'PhabricatorShortSite' => 'PhabricatorSite', 'PhabricatorShowFiletreeSetting' => 'PhabricatorSelectSetting', 'PhabricatorSignDocumentsUserLogType' => 'PhabricatorUserLogType', 'PhabricatorSimpleEditType' => 'PhabricatorEditType', - 'PhabricatorSinChartFunction' => 'PhabricatorChartFunction', + 'PhabricatorSinChartFunction' => 'PhabricatorPureChartFunction', 'PhabricatorSite' => 'AphrontSite', 'PhabricatorSlackAuthProvider' => 'PhabricatorOAuth2AuthProvider', 'PhabricatorSlowvoteApplication' => 'PhabricatorApplication', diff --git a/src/applications/fact/chart/PhabricatorConstantChartFunction.php b/src/applications/fact/chart/PhabricatorConstantChartFunction.php index cdc6c9494a..e65c577827 100644 --- a/src/applications/fact/chart/PhabricatorConstantChartFunction.php +++ b/src/applications/fact/chart/PhabricatorConstantChartFunction.php @@ -1,7 +1,7 @@ newArgument() - ->setName('x') - ->setType('function'), $this->newArgument() ->setName('max') ->setType('number'), ); } - public function getDomain() { - return $this->getArgument('x')->getDomain(); - } - - public function newInputValues(PhabricatorChartDataQuery $query) { - return $this->getArgument('x')->newInputValues($query); - } - public function evaluateFunction(array $xv) { - $yv = $this->getArgument('x')->evaluateFunction($xv); $max = $this->getArgument('max'); - foreach ($yv as $k => $y) { - if ($y > $max) { - $yv[$k] = null; + $yv = array(); + foreach ($xv as $x) { + if ($x > $max) { + $yv[] = null; + } else { + $yv[] = $x; } } diff --git a/src/applications/fact/chart/PhabricatorMinChartFunction.php b/src/applications/fact/chart/PhabricatorMinChartFunction.php index db1a003811..e6dcec06a4 100644 --- a/src/applications/fact/chart/PhabricatorMinChartFunction.php +++ b/src/applications/fact/chart/PhabricatorMinChartFunction.php @@ -1,36 +1,27 @@ newArgument() - ->setName('x') - ->setType('function'), $this->newArgument() ->setName('min') ->setType('number'), ); } - public function getDomain() { - return $this->getArgument('x')->getDomain(); - } - - public function newInputValues(PhabricatorChartDataQuery $query) { - return $this->getArgument('x')->newInputValues($query); - } - public function evaluateFunction(array $xv) { - $yv = $this->getArgument('x')->evaluateFunction($xv); $min = $this->getArgument('min'); - foreach ($yv as $k => $y) { - if ($y < $min) { - $yv[$k] = null; + $yv = array(); + foreach ($xv as $x) { + if ($x < $min) { + $yv[] = null; + } else { + $yv[] = $x; } } diff --git a/src/applications/fact/chart/PhabricatorPureChartFunction.php b/src/applications/fact/chart/PhabricatorPureChartFunction.php new file mode 100644 index 0000000000..aa1213f8c4 --- /dev/null +++ b/src/applications/fact/chart/PhabricatorPureChartFunction.php @@ -0,0 +1,4 @@ +newFunction( - 'min', array( 'accumulate', array('fact', 'tasks.open-count.assign.project', $project_phid), ), - 0); + array( + 'min', + 0, + )); $function->getFunctionLabel() ->setName(pht('Tasks Moved Into Project')) @@ -47,12 +49,14 @@ final class PhabricatorProjectBurndownChartEngine $functions[] = $function; $function = $this->newFunction( - 'min', array( 'accumulate', array('fact', 'tasks.open-count.status.project', $project_phid), ), - 0); + array( + 'min', + 0, + )); $function->getFunctionLabel() ->setName(pht('Tasks Reopened')) @@ -68,20 +72,24 @@ final class PhabricatorProjectBurndownChartEngine array('fact', 'tasks.open-count.create.project', $project_phid), ), array( - 'max', array( 'accumulate', array('fact', 'tasks.open-count.status.project', $project_phid), ), - 0, + array( + 'max', + 0, + ), ), array( - 'max', array( 'accumulate', array('fact', 'tasks.open-count.assign.project', $project_phid), ), - 0, + array( + 'max', + 0, + ), )); $function->getFunctionLabel()