Improved alone project display. Added chart line step.

This commit is contained in:
Christian P. MOMON 2020-01-20 23:10:41 +01:00
parent 758dbc8a6b
commit e918ae0884
6 changed files with 62 additions and 49 deletions

View File

@ -43,6 +43,8 @@ public class AgirStatool
{ {
private static Logger logger = LoggerFactory.getLogger(AgirStatool.class); private static Logger logger = LoggerFactory.getLogger(AgirStatool.class);
public static final char ALONE_INDICATOR = '@';
private Connection connection; private Connection connection;
private File targetDirectory; private File targetDirectory;
@ -87,7 +89,7 @@ public class AgirStatool
result = new StringList(); 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", String header = String.format("%3s %-30s %-30s %s %s %6s %6s %7s %7s %7s %7s %9s %7s %7s",
"ID", "ID",
"Identifier", "Identifier",
@ -200,10 +202,7 @@ public class AgirStatool
refreshPage(project); refreshPage(project);
for (Project subProject : project.subProjects()) 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= 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=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 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 "); 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")); // System.out.println(sql.toStringSeparatedBy("\n"));
@ -283,7 +283,8 @@ public class AgirStatool
result.issueStats().setConfirmedCount(resultSet.getLong(13)); result.issueStats().setConfirmedCount(resultSet.getLong(13));
result.issueStats().setMaybeCount(resultSet.getLong(14)); result.issueStats().setMaybeCount(resultSet.getLong(14));
result.issueStats().setWaitingCount(resultSet.getLong(15)); 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) catch (SQLException exception)
@ -371,6 +372,13 @@ public class AgirStatool
return result; return result;
} }
/**
* List projects as tree.
*
* @return the project
* @throws AgirStatoolException
* the agir statool exception
*/
public Project listProjectsAsTree() throws AgirStatoolException public Project listProjectsAsTree() throws AgirStatoolException
{ {
Project result; Project result;
@ -382,11 +390,12 @@ public class AgirStatool
Projects projects = listProjectsWithSubStats(); Projects projects = listProjectsWithSubStats();
// Add parent projects with alone statistics. // Add parent projects with alone statistics.
for (Project project : listProjectsWithRawStats()) for (Project project : listProjectsWithoutSubStats())
{ {
if (project.hasChild()) if (project.hasChild())
{ {
project.setName("#" + project.getName()); project.setName(ALONE_INDICATOR + project.getName());
project.setIdentifier(ALONE_INDICATOR + project.getIdentifier());
project.setParentId(project.getId()); project.setParentId(project.getId());
project.setChildCount(0); project.setChildCount(0);
projects.add(project); projects.add(project);
@ -419,7 +428,7 @@ public class AgirStatool
* @throws AgirStatoolException * @throws AgirStatoolException
* the agir statool exception * the agir statool exception
*/ */
public Projects listProjectsWithRawStats() throws AgirStatoolException public Projects listProjectsWithoutSubStats() throws AgirStatoolException
{ {
Projects result; 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,"); + ") 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() 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, "); + ") 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(" (select max(updated_on) from issues where issues.project_id in (" + subSql.toString() + ")) as last_issue_update ");
sql.append("FROM "); sql.append("FROM ");
@ -545,7 +555,8 @@ public class AgirStatool
project.issueStats().setUnassignedMaybeCount(resultSet.getLong(23)); project.issueStats().setUnassignedMaybeCount(resultSet.getLong(23));
project.issueStats().setUnassignedWaitingCount(resultSet.getLong(24)); 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); result.add(project);
} }
@ -575,6 +586,7 @@ public class AgirStatool
Projects result; Projects result;
result = listProjectsWithStats(true); result = listProjectsWithStats(true);
// //
return result; return result;
} }

View File

@ -45,6 +45,7 @@ public class IssueStats
private long unassignedMaybeCount; private long unassignedMaybeCount;
private long unassignedWaitingCount; private long unassignedWaitingCount;
private LocalDateTime firstCreate;
private LocalDateTime lastUpdate; private LocalDateTime lastUpdate;
/** /**
@ -94,6 +95,11 @@ public class IssueStats
return this.count; return this.count;
} }
public LocalDateTime getFirstCreate()
{
return this.firstCreate;
}
public LocalDateTime getLastUpdate() public LocalDateTime getLastUpdate()
{ {
return this.lastUpdate; return this.lastUpdate;
@ -234,6 +240,11 @@ public class IssueStats
this.count = count; this.count = count;
} }
public void setFirstCreate(final LocalDateTime firstCreate)
{
this.firstCreate = firstCreate;
}
public void setLastUpdate(final LocalDateTime lastUpdate) public void setLastUpdate(final LocalDateTime lastUpdate)
{ {
this.lastUpdate = lastUpdate; this.lastUpdate = lastUpdate;

View File

@ -42,8 +42,8 @@ public class Project
{ {
this.id = id; this.id = id;
this.identifier = identifier; this.identifier = identifier;
setPath();
this.name = name; this.name = name;
this.path = identifier + ".xhtml";
this.parentId = parentId; this.parentId = parentId;
this.subProjects = new Projects(); this.subProjects = new Projects();
this.childCount = 0; this.childCount = 0;
@ -125,6 +125,7 @@ public class Project
public void setIdentifier(final String identifier) public void setIdentifier(final String identifier)
{ {
this.identifier = identifier; this.identifier = identifier;
setPath();
} }
public void setLastUpdate(final LocalDateTime lastUpdate) public void setLastUpdate(final LocalDateTime lastUpdate)
@ -142,6 +143,11 @@ public class Project
this.parentId = parentId; this.parentId = parentId;
} }
private void setPath()
{
this.path = this.identifier + ".xhtml";
}
public Projects subProjects() public Projects subProjects()
{ {
return this.subProjects; return this.subProjects;

View File

@ -63,14 +63,6 @@ public class ProjectPage
data.setContent("unassignedRawChart", UnassignedPolarChartView.build("Unassigned Raw Count", project)); data.setContent("unassignedRawChart", UnassignedPolarChartView.build("Unassigned Raw Count", project));
data.setContent("unassignedGroupedChart", UnassignedPolarChartView.buildGrouped("Unassigned Grouped 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); String projectsRawView = ProjectsRawView.build(project);
data.setContent("projectsRawView", projectsRawView); data.setContent("projectsRawView", projectsRawView);

View File

@ -20,31 +20,29 @@ var myChart = new Chart(ctx,
type: 'line', type: 'line',
data: data:
{ {
labels: ['New', 'Started', 'Waiting', 'Maybe', 'Resolved', 'Closed'], labels: ['S01', 'S02', 'S03', 'S04', 'S05', 'S06'],
datasets: datasets:
[{ [
label: '# of Votes', {
data: [12, 19, 3, 5, 2, 3], label: 'Created',
backgroundColor: data: [2, 9, 13, 15, 22, 23],
[ backgroundColor: 'rgba(255, 99, 132, 0.2)',
'rgba(255, 99, 132, 0.2)', borderColor: 'rgba(255, 99, 132, 1)',
'rgba(54, 162, 235, 0.2)', borderWidth: 1,
'rgba(255, 206, 86, 0.2)', fill: true,
'rgba(75, 192, 192, 0.2)', /* cubicInterpolationMode: 'monotone', */
'rgba(153, 102, 255, 0.2)', lineTension: 0
'rgba(255, 159, 64, 0.2)' },
], {
borderColor: label: 'Concluded',
[ data: [1, 5, 9, 13, 15, 22],
'rgba(255, 99, 132, 1)', backgroundColor: 'rgba(75, 192, 192, 0.2)',
'rgba(54, 162, 235, 1)', borderColor: 'rgba(75, 192, 192, 1)',
'rgba(255, 206, 86, 1)', borderWidth: 1,
'rgba(75, 192, 192, 1)', fill: true,
'rgba(153, 102, 255, 1)', lineTension: 0
'rgba(255, 159, 64, 1)' }
], ]
borderWidth: 1
}]
}, },
options: options:
{ {

View File

@ -24,9 +24,6 @@
<div> <div>
<div id="issueRawChart" style="display: inline-block;">ISSUES BAR CHART</div> <div id="issueRawChart" style="display: inline-block;">ISSUES BAR CHART</div>
<div id="unassignedRawChart" style="display: inline-block;"></div> <div id="unassignedRawChart" style="display: inline-block;"></div>
<br/>
<div id="issueRawChartAlone" style="display: inline-block;"></div>
<div id="unassignedRawChartAlone" style="display: inline-block;"></div>
</div> </div>
<br/> <br/>
<div> <div>
@ -37,9 +34,6 @@
<div> <div>
<div id="issueGroupedChart" style="display: inline-block;">ISSUES BAR CHART</div> <div id="issueGroupedChart" style="display: inline-block;">ISSUES BAR CHART</div>
<div id="unassignedGroupedChart" style="display: inline-block;"></div> <div id="unassignedGroupedChart" style="display: inline-block;"></div>
<br/>
<div id="issueGroupedChartAlone" style="display: inline-block;"></div>
<div id="unassignedGroupedChartAlone" style="display: inline-block;"></div>
</div> </div>
<br/> <br/>
<div> <div>