How can I automatically log work in Greenhopper?

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

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
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
Posted Tuesday in Uncategorized

Friday fun: how many celebrates Midsummer holiday or is this a Swedish tradition only?

Any other country that celebrates Midsummer holiday (this friday 22 June)?  

47 views 3 1
Join discussion

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