Uploaded image for project: 'SR for Jira - Development'
  1. SR for Jira - Development
  2. SRJIRA-551

inconsistent scripted field values

    Details

    • Type: Bug
    • Status: Done
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 4.2.0.5
    • Fix Version/s: 5.0.11
    • Component/s: None
    • Labels:
    • Environment:

      JIRA v7.*

    • Sprint:
      Sprint 29 - Ends 10 May, Sprint 30 - Ends June 20, Sprint 31 - Ends June 27
    • Critical Points:
      0.8

      Description

      Steps to reproduce
      Create Scripted field with

      • Searcher: Number Searcher
      • Template: Number Field
      • Script
        import com.atlassian.jira.issue.Issue
        import com.atlassian.jira.issue.history.ChangeItemBean
        import com.atlassian.jira.component.ComponentAccessor
        
        enableCache = {-> false}
        Issue issue = issue
        def changeHistoryManager = ComponentAccessor.getChangeHistoryManager()
        
        def inProgressName = "In Progress"
        
        Double rt = 0
        changeHistoryManager.getChangeItemsForField (issue, "status").reverse().each {ChangeItemBean item ->
            Double timeDiff = System.currentTimeMillis() - item.created.getTime() as Double
            if (item.fromString == inProgressName) {
                rt = rt - timeDiff
            }
            if (item.toString == inProgressName){
                rt = rt + timeDiff
            }
        }
        
        log.debug("Time in progress for issue ${issue.key} - ${(rt / 1000 / 60) as Double} sec")
        (Math.round(rt / 1000 as Double) / 60) as Double
        

        Value of 'active' (in the above script an issue in progress) scripted field when refresh the agile-board or issue view screen, is inconsistent. Re indexing fixes the problem temporary.

        Attachments

          Activity

            People

            Assignee:
            scheesley Stephen Cheesley
            Reporter:
            tbatagiannis Thanos Batagiannis
            Votes:
            4 Vote for this issue
            Watchers:
            8 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: