计算数字字段的Jira错误

时间:2015-05-07 09:03:34

标签: jira jira-plugin

我们尝试根据7个变量计算问题内部优先级的WSJF编号,这些变量可以在下拉列表中自定义(customfileds)。

计算有效,可以看到带有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 ) 

1 个答案:

答案 0 :(得分:2)

execution( * org.my.package.*.*(..))让它发挥作用。 非常感谢@ ThePavolC