diff --git a/src/org/april/agirstatool/core/pages/CreatedClosedCountChartView.java b/src/org/april/agirstatool/core/pages/CreatedClosedCountChartView.java index af17077..8a0b8dc 100644 --- a/src/org/april/agirstatool/core/pages/CreatedClosedCountChartView.java +++ b/src/org/april/agirstatool/core/pages/CreatedClosedCountChartView.java @@ -168,21 +168,23 @@ public class CreatedClosedCountChartView } /** - * Builds the previous year. + * Builds the previous 2 year. * * @param title * the title * @param project * the project + * @param yearCount + * the year count * @return the string * @throws AgirStatoolException * the agir statool exception */ - public static String buildPreviousYear(final String title, final Project project) throws AgirStatoolException + public static String buildPreviousYear(final String title, final Project project, final int yearCount) throws AgirStatoolException { String result; - result = buildYear(title, project, LocalDate.now().getYear() - 1); + result = buildYear(title, project, LocalDate.now().getYear() - Math.abs(yearCount)); // return result; diff --git a/src/org/april/agirstatool/core/pages/CreatedClosedDiffChartView.java b/src/org/april/agirstatool/core/pages/CreatedClosedDiffChartView.java index f600e3e..6d44a65 100644 --- a/src/org/april/agirstatool/core/pages/CreatedClosedDiffChartView.java +++ b/src/org/april/agirstatool/core/pages/CreatedClosedDiffChartView.java @@ -159,15 +159,17 @@ public class CreatedClosedDiffChartView * the title * @param project * the project + * @param yearCount + * the year count * @return the string * @throws AgirStatoolException * the agir statool exception */ - public static String buildPreviousYear(final String title, final Project project) throws AgirStatoolException + public static String buildPreviousYear(final String title, final Project project, final int yearCount) throws AgirStatoolException { String result; - result = buildYear(title, project, LocalDate.now().getYear() - 1); + result = buildYear(title, project, LocalDate.now().getYear() - Math.abs(yearCount)); // return result; diff --git a/src/org/april/agirstatool/core/pages/IssueAgeChartView.java b/src/org/april/agirstatool/core/pages/IssueAgeChartView.java index 55e4732..41815ac 100644 --- a/src/org/april/agirstatool/core/pages/IssueAgeChartView.java +++ b/src/org/april/agirstatool/core/pages/IssueAgeChartView.java @@ -154,15 +154,17 @@ public class IssueAgeChartView * the title * @param project * the project + * @param yearCount + * the year count * @return the string * @throws AgirStatoolException * the agir statool exception */ - public static String buildPreviousYear(final String title, final Project project) throws AgirStatoolException + public static String buildPreviousYear(final String title, final Project project, final int yearCount) throws AgirStatoolException { String result; - result = buildYear(title, project, LocalDate.now().getYear() - 1); + result = buildYear(title, project, LocalDate.now().getYear() - Math.abs(yearCount)); // return result; diff --git a/src/org/april/agirstatool/core/pages/ProjectPage.java b/src/org/april/agirstatool/core/pages/ProjectPage.java index fa6129f..62772f5 100644 --- a/src/org/april/agirstatool/core/pages/ProjectPage.java +++ b/src/org/april/agirstatool/core/pages/ProjectPage.java @@ -76,6 +76,8 @@ public class ProjectPage data.setContent("lastUpdateDate", LocalDateTime.now().format(DateTimeFormatter.ofPattern("dd/MM/yyyy HH':'mm", Locale.FRANCE))); + data.setContent("createClosePrevious3YearButton", LocalDate.now().getYear() - 3); + data.setContent("createClosePrevious2YearButton", LocalDate.now().getYear() - 2); data.setContent("createClosePreviousYearButton", LocalDate.now().getYear() - 1); data.setContent("createdClosed3MonthsChart", CreatedClosedCountChartView.buildLastMonths("Created/closed 3 months Count", project, 3)); data.setContent("created-Closed3MonthsChart", CreatedClosedDiffChartView.buildLastMonths("Created-closed 3 months Count", project, 3)); @@ -86,9 +88,15 @@ public class ProjectPage data.setContent("createdClosed12MonthsChart", CreatedClosedCountChartView.buildLastMonths("Created/closed 12 months Count", project, 12)); data.setContent("created-Closed12MonthsChart", CreatedClosedDiffChartView.buildLastMonths("Created-closed 12 months Count", project, 12)); data.setContent("age12MonthsChart", IssueAgeChartView.buildLastMonths("Issue Age 12 months", project, 12)); - data.setContent("createdClosedPreviousYearChart", CreatedClosedCountChartView.buildPreviousYear("Created/closed last year Count", project)); - data.setContent("created-ClosedPreviousYearChart", CreatedClosedDiffChartView.buildPreviousYear("Created-closed last year Count", project)); - data.setContent("agePreviousYearChart", IssueAgeChartView.buildPreviousYear("Issue Age Previous Year Chart", project)); + data.setContent("createdClosedPrevious3YearChart", CreatedClosedCountChartView.buildPreviousYear("Created/closed year-3 Count", project, -3)); + data.setContent("created-ClosedPrevious3YearChart", CreatedClosedDiffChartView.buildPreviousYear("Created-closed year-3 Count", project, -3)); + data.setContent("agePrevious3YearChart", IssueAgeChartView.buildPreviousYear("Issue Age Year-3 Chart", project, -3)); + data.setContent("createdClosedPrevious2YearChart", CreatedClosedCountChartView.buildPreviousYear("Created/closed year-2 Count", project, -2)); + data.setContent("created-ClosedPrevious2YearChart", CreatedClosedDiffChartView.buildPreviousYear("Created-closed year-2 Count", project, -2)); + data.setContent("agePrevious2YearChart", IssueAgeChartView.buildPreviousYear("Issue Age Year-2 Chart", project, -2)); + data.setContent("createdClosedPreviousYearChart", CreatedClosedCountChartView.buildPreviousYear("Created/closed last year Count", project, -1)); + data.setContent("created-ClosedPreviousYearChart", CreatedClosedDiffChartView.buildPreviousYear("Created-closed last year Count", project, -1)); + data.setContent("agePreviousYearChart", IssueAgeChartView.buildPreviousYear("Issue Age Previous Year Chart", project, -1)); data.setContent("createdClosedFullChart", CreatedClosedCountChartView.buildFull("Created/closed Count", project)); data.setContent("created-ClosedFullChart", CreatedClosedDiffChartView.buildFull("Created-closed Count", project)); data.setContent("ageFullChart", IssueAgeChartView.buildFull("Issue Age Full Chart", project)); diff --git a/src/org/april/agirstatool/core/pages/project.xhtml b/src/org/april/agirstatool/core/pages/project.xhtml index c980570..78c21b8 100644 --- a/src/org/april/agirstatool/core/pages/project.xhtml +++ b/src/org/april/agirstatool/core/pages/project.xhtml @@ -19,6 +19,8 @@ 6 months 12 months Full + Year - 3 + Year - 2 Previous Year ⇊ ⇊ @@ -42,6 +44,16 @@