JavaScript calculated custom fields Cycle date does not work after 6.5.2 version

Hi, after updating to version 6.5.2 it stopped working Cycle date and Cycle days.

[jira.customfield_cycle_date]
name = "Cycle date"
data_type = "datetime"
measure = true
javascript_code = '''
var cycleStatuses = ["In Progress"];
cycleDate = null;
if (issue.changelog && issue.changelog.histories && issue.changelog.histories.length > 0) {
  var histories = issue.changelog.histories; 
  for (var i = 0; i < histories.length; i++) { 
    var history = histories[i]; 
    if (history.items && history.items.length > 0) {
      for (var n = 0; n < history.items.length; n++) {
        var item = history.items[n]; 
        if (item.field == 'status') {
          movedToStatus = item.toString;
          if(cycleStatuses.indexOf(movedToStatus) > -1) {
            cycleDate = history.created;
            break ; //disable this line if the last date is needed. Break closes the iteration through status history
          }
      } } } } 
      issue.fields.customfield_cycle_date = cycleDate; 
}
'''

interval 00-00, but tasks clearly fall into it with a large interval from status analysis to closed.

[jira.customfield_cycledays]
name = "Cycle days"
data_type = "decimal"
dimension = true
measure = true
javascript_code = '''
if (issue.fields.resolutiondate) { // calculate for resolved issues only
  var transitto = Date.parse(issue.fields.created);
  // specify a list of statuses in cycle : 
  var statuslist = ["In Progress","In Review"];
  var timeInStatus = null;
  var transitfrom = null;
  // iterate through chengelog entries to get the status changes
  issue.changelog.histories.forEach(function(history){
    history.items.forEach(function(historyItem){
      if (historyItem.field == "status") {
        transitfrom = Date.parse(history.created);
        status = historyItem.fromString;
        // validate the status by status name
        if (statuslist.indexOf(status) > -1) {
          // add time when issue moves out of the status
           timeInStatus +=  (transitfrom - transitto) / 1000 / 60 / 60 / 24 ;
        }
        transitto = transitfrom;
      }
    });
  });
  if (timeInStatus) {
  issue.fields.customfield_cycledays = timeInStatus;
  }
} 
'''
time_unit = "days"
time_interval = "duration"
intervals = "/10"
interval_unit = "days"

Hi @clank232

Welcome back to the eazyBI community!

Your JavaScript code seems correct and works on the latest eazyBI version.

However, do not use the duration between cycle start and resolution date for comparison with cycle days intervals. Cycle days calculation counts days spent in statuses “In Progress” and “In Review”, and it is not the same as duration until issue resolution day.

To check calculated cycle days for each issue, add the measure “Cycle days created” in the report:

Based on that value, issues are split into cycle days intervals (as you can see in the screenshot, issues with less than 1 day spent in those both statuses are counted to the 000-000 interval).

If you still see that all intervals are weird, you may reimport Cycle date and Cycle days custom fields: unselect them from data import, run import to delete the dimension and all related measures, and then select them back and run data import again; interval dimension will be built from scratch.

Also, you may check out and define your cycles using eazyBI built-in issue cycles functionality available starting from eazyBI version 6.5: read more Issue cycles.
While standard duration interval dimension is not available yet for cycles, there are a lot of cycle-related measures available.

Best,
Ilze , support@eazybi.com