diff --git a/src/org/april/agirstatool/core/AgirStatool.java b/src/org/april/agirstatool/core/AgirStatool.java index bc06ec2..e563dd3 100644 --- a/src/org/april/agirstatool/core/AgirStatool.java +++ b/src/org/april/agirstatool/core/AgirStatool.java @@ -43,6 +43,8 @@ public class AgirStatool { private static Logger logger = LoggerFactory.getLogger(AgirStatool.class); + public static final char ALONE_INDICATOR = '@'; + private Connection connection; private File targetDirectory; @@ -87,7 +89,7 @@ public class AgirStatool result = new StringList(); - Projects projects = listProjectsWithRawStats().sortByName(); + Projects projects = listProjectsWithoutSubStats().sortByName(); String header = String.format("%3s %-30s %-30s %s %s %6s %6s %7s %7s %7s %7s %9s %7s %7s", "ID", "Identifier", @@ -200,10 +202,7 @@ public class AgirStatool refreshPage(project); for (Project subProject : project.subProjects()) { - if (!subProject.getName().startsWith("#")) - { - refreshPage(subProject); - } + refreshPage(subProject); } } @@ -256,6 +255,7 @@ public class AgirStatool sql.append(" (select count(*) from issues where issues.project_id in (" + subSql.toString() + ") and issues.status_id= 7) as confirmed_issue_count,"); sql.append(" (select count(*) from issues where issues.project_id in (" + subSql.toString() + ") and issues.status_id=15) as maybe_issue_count,"); sql.append(" (select count(*) from issues where issues.project_id in (" + subSql.toString() + ") and issues.status_id=16) as waiting_issue_count, "); + sql.append(" (select min(created_on) from issues where issues.project_id in (" + subSql.toString() + ")) as first_issue_create, "); sql.append(" (select max(updated_on) from issues where issues.project_id in (" + subSql.toString() + ")) as last_issue_update "); // System.out.println(sql.toStringSeparatedBy("\n")); @@ -283,7 +283,8 @@ public class AgirStatool result.issueStats().setConfirmedCount(resultSet.getLong(13)); result.issueStats().setMaybeCount(resultSet.getLong(14)); result.issueStats().setWaitingCount(resultSet.getLong(15)); - result.issueStats().setLastUpdate(AgirStatoolUtils.toLocaleDateTime(resultSet.getTimestamp(16))); + result.issueStats().setFirstCreate(AgirStatoolUtils.toLocaleDateTime(resultSet.getTimestamp(16))); + result.issueStats().setLastUpdate(AgirStatoolUtils.toLocaleDateTime(resultSet.getTimestamp(17))); } } catch (SQLException exception) @@ -371,6 +372,13 @@ public class AgirStatool return result; } + /** + * List projects as tree. + * + * @return the project + * @throws AgirStatoolException + * the agir statool exception + */ public Project listProjectsAsTree() throws AgirStatoolException { Project result; @@ -382,11 +390,12 @@ public class AgirStatool Projects projects = listProjectsWithSubStats(); // Add parent projects with alone statistics. - for (Project project : listProjectsWithRawStats()) + for (Project project : listProjectsWithoutSubStats()) { if (project.hasChild()) { - project.setName("#" + project.getName()); + project.setName(ALONE_INDICATOR + project.getName()); + project.setIdentifier(ALONE_INDICATOR + project.getIdentifier()); project.setParentId(project.getId()); project.setChildCount(0); projects.add(project); @@ -419,7 +428,7 @@ public class AgirStatool * @throws AgirStatoolException * the agir statool exception */ - public Projects listProjectsWithRawStats() throws AgirStatoolException + public Projects listProjectsWithoutSubStats() throws AgirStatoolException { Projects result; @@ -501,6 +510,7 @@ public class AgirStatool + ") and issues.status_id=15 and issues.assigned_to_id is null) as unassigned_maybe_issue_count,"); sql.append(" (select count(*) from issues where issues.project_id in (" + subSql.toString() + ") and issues.status_id=16 and issues.assigned_to_id is null) as unassigned_waiting_issue_count, "); + sql.append(" (select min(created_on) from issues where issues.project_id in (" + subSql.toString() + ")) as first_issue_create, "); sql.append(" (select max(updated_on) from issues where issues.project_id in (" + subSql.toString() + ")) as last_issue_update "); sql.append("FROM "); @@ -545,7 +555,8 @@ public class AgirStatool project.issueStats().setUnassignedMaybeCount(resultSet.getLong(23)); project.issueStats().setUnassignedWaitingCount(resultSet.getLong(24)); - project.issueStats().setLastUpdate(AgirStatoolUtils.toLocaleDateTime(resultSet.getTimestamp(25))); + project.issueStats().setFirstCreate(AgirStatoolUtils.toLocaleDateTime(resultSet.getTimestamp(25))); + project.issueStats().setLastUpdate(AgirStatoolUtils.toLocaleDateTime(resultSet.getTimestamp(26))); result.add(project); } @@ -575,6 +586,7 @@ public class AgirStatool Projects result; result = listProjectsWithStats(true); + // return result; } diff --git a/src/org/april/agirstatool/core/IssueStats.java b/src/org/april/agirstatool/core/IssueStats.java index d784d1e..b91f992 100644 --- a/src/org/april/agirstatool/core/IssueStats.java +++ b/src/org/april/agirstatool/core/IssueStats.java @@ -45,6 +45,7 @@ public class IssueStats private long unassignedMaybeCount; private long unassignedWaitingCount; + private LocalDateTime firstCreate; private LocalDateTime lastUpdate; /** @@ -94,6 +95,11 @@ public class IssueStats return this.count; } + public LocalDateTime getFirstCreate() + { + return this.firstCreate; + } + public LocalDateTime getLastUpdate() { return this.lastUpdate; @@ -234,6 +240,11 @@ public class IssueStats this.count = count; } + public void setFirstCreate(final LocalDateTime firstCreate) + { + this.firstCreate = firstCreate; + } + public void setLastUpdate(final LocalDateTime lastUpdate) { this.lastUpdate = lastUpdate; diff --git a/src/org/april/agirstatool/core/Project.java b/src/org/april/agirstatool/core/Project.java index 0d6c35f..3f091f6 100644 --- a/src/org/april/agirstatool/core/Project.java +++ b/src/org/april/agirstatool/core/Project.java @@ -42,8 +42,8 @@ public class Project { this.id = id; this.identifier = identifier; + setPath(); this.name = name; - this.path = identifier + ".xhtml"; this.parentId = parentId; this.subProjects = new Projects(); this.childCount = 0; @@ -125,6 +125,7 @@ public class Project public void setIdentifier(final String identifier) { this.identifier = identifier; + setPath(); } public void setLastUpdate(final LocalDateTime lastUpdate) @@ -142,6 +143,11 @@ public class Project this.parentId = parentId; } + private void setPath() + { + this.path = this.identifier + ".xhtml"; + } + public Projects subProjects() { return this.subProjects; diff --git a/src/org/april/agirstatool/core/pages/ProjectPage.java b/src/org/april/agirstatool/core/pages/ProjectPage.java index 50fdfbe..50e38a1 100644 --- a/src/org/april/agirstatool/core/pages/ProjectPage.java +++ b/src/org/april/agirstatool/core/pages/ProjectPage.java @@ -63,14 +63,6 @@ public class ProjectPage data.setContent("unassignedRawChart", UnassignedPolarChartView.build("Unassigned Raw Count", project)); data.setContent("unassignedGroupedChart", UnassignedPolarChartView.buildGrouped("Unassigned Grouped Count", project)); - if (project.hasChild()) - { - data.setContent("issueRawChartAlone", IssueStatChartView.build("Issue Raw Count", project.subProjects().get(0))); - data.setContent("issueGroupedChartAlone", IssueStatChartView.buildGrouped("Issue Grouped Count", project.subProjects().get(0))); - data.setContent("unassignedRawChartAlone", UnassignedPolarChartView.build("Unassigned Raw Count", project.subProjects().get(0))); - data.setContent("unassignedGroupedChartAlone", UnassignedPolarChartView.buildGrouped("Unassigned Grouped Count", project.subProjects().get(0))); - } - String projectsRawView = ProjectsRawView.build(project); data.setContent("projectsRawView", projectsRawView); diff --git a/src/org/april/agirstatool/core/pages/chartLineView.xhtml b/src/org/april/agirstatool/core/pages/chartLineView.xhtml index 9d75d14..ef3685b 100644 --- a/src/org/april/agirstatool/core/pages/chartLineView.xhtml +++ b/src/org/april/agirstatool/core/pages/chartLineView.xhtml @@ -20,31 +20,29 @@ var myChart = new Chart(ctx, type: 'line', data: { - labels: ['New', 'Started', 'Waiting', 'Maybe', 'Resolved', 'Closed'], + labels: ['S01', 'S02', 'S03', 'S04', 'S05', 'S06'], datasets: - [{ - label: '# of Votes', - data: [12, 19, 3, 5, 2, 3], - backgroundColor: - [ - 'rgba(255, 99, 132, 0.2)', - 'rgba(54, 162, 235, 0.2)', - 'rgba(255, 206, 86, 0.2)', - 'rgba(75, 192, 192, 0.2)', - 'rgba(153, 102, 255, 0.2)', - 'rgba(255, 159, 64, 0.2)' - ], - borderColor: - [ - 'rgba(255, 99, 132, 1)', - 'rgba(54, 162, 235, 1)', - 'rgba(255, 206, 86, 1)', - 'rgba(75, 192, 192, 1)', - 'rgba(153, 102, 255, 1)', - 'rgba(255, 159, 64, 1)' - ], - borderWidth: 1 - }] + [ + { + label: 'Created', + data: [2, 9, 13, 15, 22, 23], + backgroundColor: 'rgba(255, 99, 132, 0.2)', + borderColor: 'rgba(255, 99, 132, 1)', + borderWidth: 1, + fill: true, + /* cubicInterpolationMode: 'monotone', */ + lineTension: 0 + }, + { + label: 'Concluded', + data: [1, 5, 9, 13, 15, 22], + backgroundColor: 'rgba(75, 192, 192, 0.2)', + borderColor: 'rgba(75, 192, 192, 1)', + borderWidth: 1, + fill: true, + lineTension: 0 + } + ] }, options: { diff --git a/src/org/april/agirstatool/core/pages/project.xhtml b/src/org/april/agirstatool/core/pages/project.xhtml index a151a2d..45e87d6 100644 --- a/src/org/april/agirstatool/core/pages/project.xhtml +++ b/src/org/april/agirstatool/core/pages/project.xhtml @@ -24,9 +24,6 @@