Kepler CF SIL Script to compute time difference not working properly

Hi,

 

I created a CF using com.keplerrominfo.jira.plugins.keplercf plugin. It is supposed to compute a simple difference between 2 other CFs : start & end.

 

Code:

 

interval i ;
if (isNotNull(customfield_10613) and isNotNull(customfield_10612) ) {
// if (customfield_10613>0) {
     i = customfield_10613 - customfield_10612;
     return (string)(i["TOMILLIS"] / 600000) + "m"; // will return "17m" as string
} else {
    // i = currentDate() - created;
    // return i;
    return 0;
}

 

Where:

10612 = Actual Issue start time

 10613 = Actual issue end time


The code above does not return the proper result sad 


Actual Issue start time:10/Nov/15 1:34 PM
Actual issue end time:10/Nov/15 2:54 PM
Actual issue duration:8m


Expected result would be "80m", not "8m".

 

Am I doing something wrong, or is there an issue with the plugin?


Versions:

JIRA: v6.4.8#64023-sha1:bab6790

Service Desk: 2.5.9

Kepler CF: 3.0.3


CF Searcher: I tried using both Interval & Free text searcher with similar results.


Would someone have any hints?


Thanks

Gabriel

1 answer

1 accepted

Hi Gabriel,

 

return (string)(i["TOMILLIS"] / 600000) + "m";

You are dividing by 600.000, but it should be 60.000 ( 1000 for millis to seconds, 60 from seconds to minutes ). The extra 0 is causing the off by 10x error.

 

Hope this helps,

Silviu

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Tuesday in Marketplace Apps

If you’re an Atlassian app developer, you’ll want to know about Atlas Camp!

This September 6-7, hundreds of Atlassian App developers will flock to Barcelona Spain to build skills, discover product roadmaps, meet face-to-face with the Atlassian team, and learn how to extend t...

110 views 0 3
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you