Hi
I'm using the solution from Riada https://riada.se/blog/sana/estimate-your-sub-tasks-in-jira-agile/ to be able to use the summed up Estimate from the sub-tasks instead of the Estimate only from the Story in a Scrum board. So I want the sub-tasks to roll up to the Estimate value which it does, but not immediately.
I also have a listener that does reindex/update both the issue itself and its parent (if it has one). But when I create a sub-task and set an Original Estimate, the parent Issues Estimate field (and the scripted field that contain the sum) doesn't change until I do some update like edit, change the ranking or such on the parent issue. The idea with the listener is of course that the changes should be instant. But if I for example remove a sub-task the value updates instantly so it seems to be that the reindex listener misses out that I have created a sub-task?? The sub task fires an Issue Created event and I also added the reindex post function but it doesn't help.
Does anyone have any idea why the listener doesn't run when creating the sub-task?
This is basically the interesting part of the reindex listener:
@EventListener public void onIssueEvent(IssueEvent issueEvent) { Long eventTypeId = issueEvent.getEventTypeId(); Issue issue = issueEvent.getIssue(); Issue parent = issue.getParentObject(); // if an event is triggered, re-index if (!eventTypeId.equals(EventType.ISSUE_DELETED_ID)){ reIndexIssue(issue); if (parent != null) { reIndexIssue(parent); } } }
Changing Alejo's comment to an answer so that this shows up as answered:
Below is an example of a listener with logging:
class ExampleListener extends AbstractIssueEventListener { Category log = Category.getInstance(ExampleListener.class) @Override void workflowEvent(IssueEvent event) { log.debug "Event: ${event.getEventTypeId()} fired for ${event.issue} and caught by ExampleListener" } }
If you just update the groovy class it will be reloaded automatically. So there is no need to recompile it.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ok I will see if I can remember how to recompile the listener. Thank you.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It could be that the timings are not the right ones, but I guess you can find out more information adding some logging. Below is an example of a listener with logging: class ExampleListener extends AbstractIssueEventListener { Category log = Category.getInstance(ExampleListener.class) @Override void workflowEvent(IssueEvent event) { log.debug "Event: ${event.getEventTypeId()} fired for ${event.issue} and caught by ExampleListener" } }
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This is part of the listener but where does System.out.println("Reindex error!!") end up? In what file? public void reIndexIssue(Issue issue){ boolean wasIndexing = ImportUtils.isIndexIssues(); ImportUtils.setIndexIssues(true); try { ComponentAccessor.getIssueIndexManager().reIndex(issue); } catch (IndexException e) { System.out.println("Reindex error!!"); }finally{ ImportUtils.setIndexIssues(wasIndexing); } }
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Perhaps I should add that the scripted field goes through all sub-tasks of an issue and sum up their original estimate values, this value is then being written to another numeric field that is used as Estimate. My feeling is that there is some sort of lag when creating a new sub-task so even if the listener is called it doesn't get the new value in time. Do you know how to enable logging in the listener?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
No I didn't unfortunately because I couldn't really figure out how to introduce log messages to any log I can read. But basically if it would run it would fix the calculation I guess. To me it seems like it is invoked before the value of the sub-tasks original estimate is updated or something...could that be the case? Next time the parent issue is updated it gets fixed.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Linus, Did you try adding some log messages inside the onIssueEvent method to verify that the listener is not called?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.