Hello,
I have installed JIRA Misc Custom field to calculate numbers value from fields and it works properly, however now I need to investigate more the function of this addon.
first question - Is that possible to calculate the time spent from Transition 1 up until we execute to transition 2? If yes, could you please provide a simple formula for it?
second question - is that possible to calculate gap time within 1 same status. For example after we execute transition 2, it will takes us to Status "Ready for Testing". Is that a way to calculate time from the moment we execute the transition 2 goes to "ready for testing" status until someone create a first comment under that status to indicate acknowledgment of this status.
Many thanks.
For this calculations you could try using ScriptRunner (free for JIRA6, need payment for JIRA7).
Here is an example of script to analise change history. It takes an issue status on 11 am of last friday.
import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.issue.Issue import com.atlassian.jira.issue.changehistory.ChangeHistory import com.atlassian.jira.issue.changehistory.ChangeHistoryManager import com.atlassian.jira.issue.history.ChangeItemBean /** * Created by VZverev on 01.12.2015. */ Issue issue; ///Начальное значение для статуса PreviousStatus prevStatus = new PreviousStatus(Calendar.getInstance().getTimeInMillis(), issue.getStatusObject().getName()); ChangeHistoryManager changeHistoryManager = ComponentAccessor.getChangeHistoryManager(); //Дата, с которой анализируем историю изменений Calendar lastFriday = Calendar.getInstance(); lastFriday.add(Calendar.WEEK_OF_YEAR, -1); lastFriday.set(Calendar.DAY_OF_WEEK, Calendar.FRIDAY); lastFriday.set(Calendar.HOUR,11); Date lastFridayDate = new Date(lastFriday.getTimeInMillis()) if(issue.getCreated().getTime() > lastFriday.getTimeInMillis()) return "новый запрос"; for(ChangeHistory changeHistory: changeHistoryManager.getChangeHistoriesSince(issue, lastFridayDate)) { for(ChangeItemBean changeItemBean: changeHistory.getChangeItemBeans()) if(changeItemBean.getField().equals("status")) { prevStatus.setNewStatus(changeItemBean.getCreated().getTime(), changeItemBean.getFromString()); break; } } return prevStatus.getStatus().equals(issue.getStatusObject().getName())?"не изменился": prevStatus.getStatus() class PreviousStatus{ private long dateInMills; private String value; public PreviousStatus(long _dateInMills, String _value){ dateInMills = _dateInMills; value = _value; } public setNewStatus(long _dateInMills, String _value){ if(_dateInMills < dateInMills){ dateInMills = _dateInMills; value = _value; } } public String getStatus(){return value} }
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.