From bc3f4fc26f71e2457bbab03214a463f23ed9fd50 Mon Sep 17 00:00:00 2001 From: "Christian P. MOMON" Date: Wed, 29 Jan 2020 14:10:50 +0100 Subject: [PATCH] Fixed age extract issues. --- src/org/april/agirstatool/core/Issue.java | 35 ++++++++++++++++++++++ src/org/april/agirstatool/core/Issues.java | 13 +------- 2 files changed, 36 insertions(+), 12 deletions(-) diff --git a/src/org/april/agirstatool/core/Issue.java b/src/org/april/agirstatool/core/Issue.java index f03bfc5..eb65b40 100644 --- a/src/org/april/agirstatool/core/Issue.java +++ b/src/org/april/agirstatool/core/Issue.java @@ -144,6 +144,41 @@ public class Issue return this.projectId; } + /** + * Checks if is active at. + * + * @param date + * the date + * @return true, if is active at + */ + public boolean isActiveAt(final LocalDate date) + { + boolean result; + + LocalDate createdDate = this.createdOn.toLocalDate(); + LocalDate closedDate; + if (this.closedOn == null) + { + closedDate = null; + } + else + { + closedDate = this.closedOn.toLocalDate(); + } + + if ((!createdDate.isAfter(date)) && ((closedDate == null) || (date.isBefore(closedDate)))) + { + result = true; + } + else + { + result = false; + } + + // + return result; + } + public void setClosedOn(final LocalDateTime closedOn) { this.closedOn = closedOn; diff --git a/src/org/april/agirstatool/core/Issues.java b/src/org/april/agirstatool/core/Issues.java index 58fdd3a..e228d2b 100644 --- a/src/org/april/agirstatool/core/Issues.java +++ b/src/org/april/agirstatool/core/Issues.java @@ -106,18 +106,7 @@ public class Issues extends ArrayList for (Issue issue : this) { - LocalDate createdOn = issue.getCreatedOn().toLocalDate(); - LocalDate closedOn; - if (issue.getClosedOn() == null) - { - closedOn = null; - } - else - { - closedOn = issue.getClosedOn().toLocalDate(); - } - - if ((!createdOn.isAfter(date)) && ((issue.getClosedOn() == null) || (!closedOn.isBefore(date)))) + if (issue.isActiveAt(date)) { result.add(issue); }