带有计算数字字段的 Jira 错误

Jira Errors with Calculated Number Field

我们尝试根据可以在下拉列表(自定义文件)中选择的 7 个变量来计算 WSJF 编号,以便对问题进行内部优先排序。

计算有效,可以看到带有 wsjf 数字的计算数字字段。 但是公式似乎以某种方式在日志中不断出错,我们的 jira 实例甚至因为日志文件变得太大而崩溃。

计算公式为:

 <!-- @@Formula:

    //Constants
    var a = 0.3; // Strategical alignment (sa) and Revenue potential (rp) are weighted 30%
    var b = 0.2; // Saving potential (sp) and competitive advantage (ca) are weighted 20%
    var x = 2; // Is the factor for the weight of "business value" (bv) in the model
    var y = 1; // Is the factor for the weight of the "loss of value" (lv) in the model
    var z = 1; // Is the factor for the weight of the "capacity increase" (ci) in the model

    //Variables for business value
    var sa = Integer.parseInt(issue.get("customfield_11631") != null ? issue.get("customfield_11631") : 0);
    var rp = Integer.parseInt(issue.get("customfield_11632") != null ? issue.get("customfield_11632") : 0);
    var sp = Integer.parseInt(issue.get("customfield_11633") != null ? issue.get("customfield_11633") : 0);
    var ca = Integer.parseInt(issue.get("customfield_11634") != null ? issue.get("customfield_11634"): 0);
    var bv = (sa+rp)*a + (sp+ca)*b;

    //Variables for loss of value over time
    var lv = Integer.parseInt(issue.get("customfield_11635") != null ? issue.get("customfield_11635") : 0);

    //Variables for capacity increase
    var ci = Integer.parseInt(issue.get("customfield_11636") != null ? issue.get("customfield_11636") : 0);

    //Variables for investment
    var in = Integer.parseInt(issue.get("customfield_11637") != null ? (issue.get("customfield_11637") : 0);

    //WSJF calculation
    var wsjf = (x*bv+y*lv+z*ci)/in;

       return wsjf;

    -->

日志文件中的错误如下所示:

2015-05-06 14:16:40,133 http-bio-443-exec-866 ERROR Andreas Kundert 856x2705040x1 41jq3d 192.168.37.39:63202,192.168.211.105 /secure/AjaxIssueAction.jspa [innovalog.jmcf.fields.CalculatedNumberField] CalculatedNumberField: error evaluating formula of field "WSJF (automated)" of issue BI-24: 
Sourced file: inline evaluation of: ``    //Constants  var a = 0.3; // Strategical alignment (s) and Revenue potential . . . '' : Typed variable declaration : Method Invocation Integer.parseInt : at Line: 11 : in file: inline evaluation of: ``    //Constants  var a = 0.3; // Strategical alignment (s) and Revenue potential . . . '' : Integer .parseInt ( issue .get ( "customfield_11631" ) ) 

CalculatedNumberField: error evaluating formula of field "WSJF (automated)" of issue LIAR-101: 
Sourced file: inline evaluation of: ``    //Constants  var a = 0.3; // Strategical alignment (s) and Revenue potential . . . '' : Typed variable declaration : Error in method invocation: Static method parseInt( int ) not found in class'java.lang.Integer' : at Line: 11 : in file: inline evaluation of: ``    //Constants  var a = 0.3; // Strategical alignment (s) and Revenue potential . . . '' : Integer .parseInt ( issue .get ( "customfield_11631" ) != null ? issue .get ( "customfield_11631" ) : 0 ) 

int i = (issue.get("customfield_11631") != null ? Integer.parseInt(issue.get("customfield_11631").toString()) : 0) 成功了。 非常感谢@ThePavolC