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);
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;
}

View file

@ -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;

View file

@ -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;

View file

@ -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);

View file

@ -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:
{

View file

@ -24,9 +24,6 @@
<div>
<div id="issueRawChart" style="display: inline-block;">ISSUES BAR CHART</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>
<br/>
<div>
@ -37,9 +34,6 @@
<div>
<div id="issueGroupedChart" style="display: inline-block;">ISSUES BAR CHART</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>
<br/>
<div>