protected Long getDuration(Issue issue) { return issue.getTimeSpent(); } }
public Long getTimeSpent() { return issue.getTimeSpent(); }
public Long getTimeSpent() { return issue.getTimeSpent(); }
/** * Return a formatted time string of the time spent. * * @param i18n helper bean for internationalization * @return String formatted string of time spent */ public String getNiceTimeSpent(I18nHelper i18n) { return convertToNiceTime(issue.getTimeSpent(), i18n); }
public String getTimeSpent() { return durationFormatter.shortFormat(issue.getTimeSpent()); }
public void addIndex(Document doc, Issue issue) { indexLongAsPaddedKeywordWithDefault(doc, getDocumentFieldId(), issue.getTimeSpent(), NO_VALUE_INDEX_VALUE, issue); }
public static long getWorkRatio(Issue issue) { return getWorkRatio(issue.getOriginalEstimate(), issue.getTimeSpent()); }
/** * Are there are any values against this issue at all. * * @return true if any times have been logged or estimated. */ public boolean isTimeTracked() { return isTracked(issue.getOriginalEstimate(), issue.getEstimate(), issue.getTimeSpent()); }
public String getAccuracyNice() { return accuracyCalculator.calculateAndFormatAccuracy(issue.getOriginalEstimate(), issue.getEstimate(), issue.getTimeSpent()); }
public String getAccuracyPercentage() { return getAccuracyPercentage(issue.getOriginalEstimate(), issue.getEstimate(), issue.getTimeSpent()); }
public int onSchedule() { return accuracyCalculator.onSchedule(issue.getOriginalEstimate(), issue.getEstimate(), issue.getTimeSpent()); }
@Override protected TimeTrackingParameters getTimeTrackingGraphBeanParameters(final Issue issue, final I18nHelper helper) { return new TimeTrackingParameters(issue.getTimeSpent(), issue.getOriginalEstimate(), issue.getEstimate(), factory.createBean(issue, TimeTrackingGraphBeanFactory.Style.NORMAL, helper)); }
public void addIndex(Document doc, Issue issue) { indexLongAsPaddedKeywordWithDefault(doc, getDocumentFieldId(), issue.getEstimate(), NO_VALUE_INDEX_VALUE, issue); indexLongAsPaddedKeywordWithDefault(doc, DocumentConstants.ISSUE_TIME_SPENT, issue.getTimeSpent(), NO_VALUE_INDEX_VALUE, issue); } }
public String getAccuracy() { Long accuracy = accuracyCalculator.calculateAccuracy(issue.getOriginalEstimate(), issue.getEstimate(), issue.getTimeSpent()); return durationFormatter.format(accuracy); }
@Override public TimeTrackingGraphBean createBean(final Issue issue, final Style style, final I18nHelper helper) { notNull("helper", helper); notNull("issue", issue); notNull("style", style); final Long orig = issue.getOriginalEstimate(); final Long estimate = issue.getEstimate(); final Long spent = issue.getTimeSpent(); return createBean(style, helper, orig, spent, estimate); }
/** * Does an issue have timetracking data, only makes sense if time tracking is turned on. * * @param issue the issue. * @return true if the issue has any time tracking information * @since v3.11 */ public static boolean hasTimeTracking(Issue issue) { if (issue == null) { return false; } Long orig = issue.getOriginalEstimate(); Long est = issue.getEstimate(); Long spent = issue.getTimeSpent(); return isNonZeroNumber(orig) || isNonZeroNumber(est) || isNonZeroNumber(spent); }
@Override public FieldJsonRepresentation getJsonFromIssue(Issue issue, boolean renderedVersionRequested, @Nullable FieldLayoutItem fieldLayoutItem) { JiraDurationUtils jiraDurationUtils = ComponentAccessor.getComponent(JiraDurationUtils.class); String originalEstimate = issue.getOriginalEstimate() == null ? null : jiraDurationUtils.getShortFormattedDuration(issue.getOriginalEstimate()); String estimate = issue.getEstimate() == null ? null : jiraDurationUtils.getShortFormattedDuration(issue.getEstimate()); String timeSpent = issue.getTimeSpent() == null ? null : jiraDurationUtils.getShortFormattedDuration(issue.getTimeSpent()); TimeTrackingJsonBean timeTrackingJsonBean = TimeTrackingJsonBean.shortBean(originalEstimate, estimate, timeSpent, issue.getOriginalEstimate(), issue.getEstimate(), issue.getTimeSpent()); if (renderedVersionRequested) { String renderedOriginalEstimate = issue.getOriginalEstimate() == null ? null : jiraDurationUtils.getFormattedDuration(issue.getOriginalEstimate(), authenticationContext.getLocale()); String renderedEstimate = issue.getEstimate() == null ? null : jiraDurationUtils.getFormattedDuration(issue.getEstimate(), authenticationContext.getLocale()); String renderedTimeSpent = issue.getTimeSpent() == null ? null : jiraDurationUtils.getFormattedDuration(issue.getTimeSpent(), authenticationContext.getLocale()); TimeTrackingJsonBean renderedTimeTrackingJsonBean = TimeTrackingJsonBean.shortBean(renderedOriginalEstimate, renderedEstimate, renderedTimeSpent, issue.getOriginalEstimate(), issue.getEstimate(), issue.getTimeSpent()); return new FieldJsonRepresentation(new JsonData(timeTrackingJsonBean), new JsonData(renderedTimeTrackingJsonBean)); } else { return new FieldJsonRepresentation(new JsonData(timeTrackingJsonBean)); } }
public AggregateTimeTrackingBean getAggregates(final Issue issue) { if (issue == null) { throw new IllegalArgumentException("The issue must not be null"); } final AggregateTimeTrackingBean aggregateBean = new AggregateTimeTrackingBean(issue.getOriginalEstimate(), issue.getEstimate(), issue.getTimeSpent(), 0); if (issue.isSubTask()) { return aggregateBean; } Query query = getSubTaskClause(issue.getId()).buildQuery(); IndexSearcher searcher = searchProviderFactory.getSearcher(SearchProviderFactory.ISSUE_INDEX); AggregateHitCollector collector = new AggregateHitCollector(searcher, aggregateBean, remainingEstimateSorter, originalEstimateSorter, timeSpentSorter); try { searchProvider.search(query, getUser(), collector); aggregateBean.setSubTaskCount(collector.getInvocationCount()); } catch (SearchException e) { throw new RuntimeException(e); } return aggregateBean; }
@Override public void updateIssueOnWorklogCreate(ApplicationUser user, Worklog worklog, Long newEstimate, boolean dispatchEvent) { validateWorklogAndIssue(worklog); final Issue issue = worklog.getIssue(); GenericValue issueGV = issue.getGenericValue(); // if new estimate is null, leave it - otherwise set it now setNewEstimate(newEstimate, issueGV); // now increase the amount of total time spent on the issue Long timeSpent = worklog.getTimeSpent(); Long totalTimeSpent = issue.getTimeSpent(); if (totalTimeSpent == null) { totalTimeSpent = timeSpent; } else { totalTimeSpent = totalTimeSpent + timeSpent; } issueGV.set("timespent", totalTimeSpent); updateIssue(issueGV, user, null, worklog, ISSUE_WORKLOGGED_ID, constructChangeItemBeansForWorklogUpdateOrCreate(worklog), dispatchEvent); }
@Override public void updateIssueOnWorklogDelete(ApplicationUser user, Worklog worklog, Long newEstimate, boolean dispatchEvent) { validateWorklogAndIssue(worklog); // if new estimate is null, leave it - otherwise set it now final Issue issue = worklog.getIssue(); GenericValue issueGV = issue.getGenericValue(); setNewEstimate(newEstimate, issueGV); long newTotalTimeSpent; // Calculate new totalTimeSpent for edit // now increase the amount of total time spent on the issue Long timeSpent = worklog.getTimeSpent(); Long totalTimeSpent = issue.getTimeSpent(); if (totalTimeSpent == null) { newTotalTimeSpent = 0; } else { // We calculate the total time spent by subtracting the amount of time spent on the deleted worklog. newTotalTimeSpent = totalTimeSpent - timeSpent; if (newTotalTimeSpent < 0) { newTotalTimeSpent = 0; } } issueGV.set("timespent", newTotalTimeSpent); updateIssue(issueGV, user, null, worklog, ISSUE_WORKLOG_DELETED_ID, constructChangeItemBeansForWorklogDelete(worklog), dispatchEvent); }