time estimate from a specific date (custom field)

LS February 23, 2015

Hi,

I'm trying to develop  a script to get the last value of the field "Remaining estimate" before a specific date (custom field). The script should get the value based on the date of the last log work.

We developed the script below, but we could only get the value of WorkID. Could you help me?

 

import com.atlassian.jira.ComponentManager
import com.atlassian.jira.component.ComponentAccessor
def cont = 0 
def inicio = 0
def log = 0
def date = new Date(01-01-2001)
def ref = getCustomFieldValue("Data de Referência") as Date
def worklogManager = ComponentAccessor.getWorklogManager()
def componentManager = ComponentManager.getInstance()
def changeHistoryManager = componentManager.getChangeHistoryManager()
def alvo = changeHistoryManager.getChangeItemsForField(issue, "WorklogId")
ListIterator alvo_itr = alvo.listIterator();

    while(alvo_itr.hasNext())
    {
        
        cont += 1
        alvo = alvo_itr.next(); 
        result = alvo.getFrom() as Long
        inicio = worklogManager.getById(result).getStartDate() as Date
        criacao = worklogManager.getById(result).getCreated() as Date    
			if (inicio <= ref) {
              if (criacao >= date) { 
			  log = result
			  date = criacao 
            }
    }
    }
        
   
                
    
return log as String

Thank you

2 answers

0 votes
JamieA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 24, 2015

I don't really understand the question. Worklogs are stored separately from the issue. Remaning estimate is calculated based on the time remaining on subtasks, so to get it at a point in time you would need to know the subtasks as of that time, and their remaining estimate as of that time.

LS February 24, 2015

Sorry. Actually, we need to get the "time remaining" value from sub-tasks of a specific date. We need to get to "estimate time" value related to worklogID we got.

Alvaro DAlessandro February 24, 2015

As far as I could see, the script is actually returning the correct value, but it seems to be "expected" some sort of update behavior in order for that value to be available for use in other/subsequent context (e.g. in a query)

0 votes
Sergio Silva February 24, 2015

@Jamie Echlin [Adaptavist] Can you help us? We need to get the resulting timeestimate the worklogId found?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events