How can I automatically log work in Greenhopper?

John Price
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.
July 12, 2011

I am just starting on Greenhopper and we were going to try to just use the original estimates rather than work logging (to reduce overhead). What I was hoping was:

* set original estimate

* when closing ticket, GH sets remaining estimate to zero (this works)

* burndown chart shows the hours burned down.

Instead, burndown charts are flat. GH seems to log a dummy 1 minute work log. Do I need to tell the team to start logging work in detail, or is there a way to make this happen on close? Example:

Original Est: 4 hours

* drag to done

* Sets Remaining Est. to 0 hours

* Logs 4 hours work to make the burndown correct

If this isn't possible I would love guidance on how to log work efficiently without extra issue edits/etc.

1 answer

1 accepted

0 votes
Answer accepted
Alexander Ewert July 20, 2011

You can create postfunction with functionality to add worklogs to Issue and add it to resolve transition.

Something similar to this:

    public void execute(Map transientVars, Map args, PropertySet ps) throws FieldValidationException {
WorklogManager worklogManager = ComponentManager.getInstance().getWorklogManager();
WorkflowContext context = (WorkflowContext) transientVars.get("context");
String username = context.getCaller();
Issue issue = (Issue) transientVars.get("issue");
Worklog worklog;
Long timeSpent = issue.getEstimate();
Principal principal = ActionContext.getContext().getPrincipalImpl();
boolean dispatchEvent = false; //Set tot true if you need email notifications
if (timeSpent != null && timeSpent > 0 && principal != null && principal instanceof User) {
worklog = new WorklogImpl(worklogManager, issue, null, username, "Place Log Work Comment Here", new Date(),
null, null, timeSpent);
worklogManager.create((User) principal, worklog, 0L, dispatchEvent);
}

Moreover you can calculate how long issue was in specific state and log this time as worklog, you can even calculate only working hours between dates.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events