Compare commits

...

5 Commits

11 changed files with 158 additions and 89 deletions

View File

@ -1,3 +1,3 @@
#Build Number for ANT. Do not edit!
#Wed Feb 05 18:54:17 CET 2020
build.number=27
#Fri Mar 06 14:21:17 CET 2020
build.number=28

View File

@ -22,6 +22,7 @@ import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Date;
import java.util.Iterator;
import java.util.Locale;
import org.apache.commons.lang3.StringUtils;
@ -113,7 +114,7 @@ public class AgirStatoolUtils
LocalDate date = AgirStatoolUtils.normaliseWeekDate(start);
while (date.isBefore(normalizedEnd) || date.isEqual(normalizedEnd))
{
String label = date.format(DateTimeFormatter.ofPattern("yyyy-MMM", Locale.FRANCE));
String label = date.format(DateTimeFormatter.ISO_DATE);
result.add(label);
date = date.plusWeeks(1);
}
@ -530,6 +531,38 @@ public class AgirStatoolUtils
return result;
}
/**
* To J son numbers.
*
* @param labels
* the labels
* @param values
* the source
* @return the string
*/
public static String toJSonNumbers(final StringList labels, final StringList values)
{
String result;
Iterator<String> labelIterator = labels.iterator();
Iterator<String> valueIterator = values.iterator();
StringList buffer = new StringList();
while (labelIterator.hasNext())
{
String label = labelIterator.next();
String value = valueIterator.next();
// buffer.append("{t: new Date('" + label + "'), y: " + value +
// "}");
buffer.append("{t: '" + label + "', y: " + value + "}");
}
result = StringsUtils.toString(buffer, "[", ",", "]");
//
return result;
}
/**
* To Json strings.
*

View File

@ -69,15 +69,14 @@ public class CreatedClosedCountChartView
code = code.replaceAll("myChart", "myChart_" + DigestUtils.md5Hex(title + "lineChart"));
StringList labels = AgirStatoolUtils.buildWeekLabels(start, end);
code = code.replaceAll("labels: \\[.*\\]", "labels: " + AgirStatoolUtils.toJSonStrings(labels));
DateCountList dates = project.issueStats().getWeekCreatedIssueCounts();
StringList values = AgirStatoolUtils.normalizedWeekCountList(dates, start, end).toValueList();
code = code.replaceAll("data: \\[.*\\]", "data: " + AgirStatoolUtils.toJSonNumbers(values));
code = code.replaceAll("data: \\[.*\\]", "data: " + AgirStatoolUtils.toJSonNumbers(labels, values));
dates = project.issueStats().getWeekConcludedIssueCounts();
values = AgirStatoolUtils.normalizedWeekCountList(dates, start, end).toValueList();
code = code.replaceAll("data: \\[.*\\] ", "data: " + AgirStatoolUtils.toJSonNumbers(values));
code = code.replaceAll("data: \\[.*\\] ", "data: " + AgirStatoolUtils.toJSonNumbers(labels, values));
result = code.toString();
}
@ -122,13 +121,12 @@ public class CreatedClosedCountChartView
code = code.replaceAll("myChart", "myChart_" + DigestUtils.md5Hex(title + "lineBar"));
StringList labels = AgirStatoolUtils.buildWeekLabels(project.issueStats().getFirstCreate().toLocalDate());
code = code.replaceAll("labels: \\[.*\\]", "labels: " + AgirStatoolUtils.toJSonStrings(labels));
StringList values = project.issueStats().getWeekCreatedIssueCounts().toValueList();
code = code.replaceAll("data: \\[.*\\]", "data: " + AgirStatoolUtils.toJSonNumbers(values));
code = code.replaceAll("data: \\[.*\\]", "data: " + AgirStatoolUtils.toJSonNumbers(labels, values));
values = project.issueStats().getWeekConcludedIssueCounts().toValueList();
code = code.replaceAll("data: \\[.*\\] ", "data: " + AgirStatoolUtils.toJSonNumbers(values));
code = code.replaceAll("data: \\[.*\\] ", "data: " + AgirStatoolUtils.toJSonNumbers(labels, values));
result = code.toString();
}

View File

@ -69,9 +69,6 @@ public class CreatedClosedDiffChartView
code = code.replaceAll("myChart", "myChart_" + DigestUtils.md5Hex(title + "line2Chart"));
StringList labels = AgirStatoolUtils.buildWeekLabels(start, end);
code = code.replaceAll("labels: \\[.*\\]", "labels: " + AgirStatoolUtils.toJSonStrings(labels));
DateCountList createdDates = project.issueStats().getWeekCreatedIssueCounts();
DateCountList closedDates = project.issueStats().getWeekConcludedIssueCounts();
DateCountList dates = new DateCountList(createdDates.size());
@ -82,8 +79,9 @@ public class CreatedClosedDiffChartView
dates.add(new DateCount(createdDate.getDate(), createdDate.getCount() - closedDate.getCount()));
}
StringList labels = AgirStatoolUtils.buildWeekLabels(start, end);
StringList values = AgirStatoolUtils.normalizedWeekCountList(dates, start, end).toValueList();
code = code.replaceAll("data: \\[.*\\]", "data: " + AgirStatoolUtils.toJSonNumbers(values));
code = code.replaceAll("data: \\[.*\\]", "data: " + AgirStatoolUtils.toJSonNumbers(labels, values));
result = code.toString();
}

View File

@ -68,16 +68,15 @@ public class IssueAgeChartView
code = code.replaceAll("myChart", "myChart_" + DigestUtils.md5Hex(title + "ageStatsChart"));
StringList labels = AgirStatoolUtils.buildWeekLabels(start, end);
code = code.replaceAll("labels: \\[.*\\]", "labels: " + AgirStatoolUtils.toJSonStrings(labels));
StringList values = AgirStatoolUtils.buildWeekMinAges(project, start, end);
code = code.replaceAll("data: \\[.*\\]", "data: " + AgirStatoolUtils.toJSonNumbers(values));
code = code.replaceAll("data: \\[.*\\]", "data: " + AgirStatoolUtils.toJSonNumbers(labels, values));
values = AgirStatoolUtils.buildWeekMeanAges(project, start, end);
code = code.replaceAll("data : \\[.*\\]", "data: " + AgirStatoolUtils.toJSonNumbers(values));
code = code.replaceAll("data : \\[.*\\]", "data: " + AgirStatoolUtils.toJSonNumbers(labels, values));
values = AgirStatoolUtils.buildWeekMaxAges(project, start, end);
code = code.replaceAll("data : \\[.*\\]", "data: " + AgirStatoolUtils.toJSonNumbers(values));
code = code.replaceAll("data : \\[.*\\]", "data: " + AgirStatoolUtils.toJSonNumbers(labels, values));
result = code.toString();
}

View File

@ -38,34 +38,6 @@ public class IssueStatusChartView
{
private static Logger logger = LoggerFactory.getLogger(IssueStatusChartView.class);
/**
* Builds the grouped.
*
* @param title
* the title
* @param project
* the project
* @return the string
* @throws AgirStatoolException
* the agir statool exception
*/
public static String buildGrouped(final String title, final Project project) throws AgirStatoolException
{
String result;
StringList labels = new StringList("Maybe", "Active", "Resolved");
StringList values = new StringList();
values.append(project.issueStats().getMaybeCount());
values.append(project.issueStats().getActiveCount());
values.append(project.issueStats().getResolvedCount());
String targetTitle = title + " " + project.getName();
result = build(targetTitle, targetTitle, labels, values);
//
return result;
}
/**
* Builds the.
*
@ -90,8 +62,7 @@ public class IssueStatusChartView
values.append(project.issueStats().getWaitingCount());
values.append(project.issueStats().getResolvedCount());
String targetTitle = title + " " + project.getName();
result = build(targetTitle, targetTitle, labels, values);
result = build(title, title, labels, values);
//
return result;
@ -136,4 +107,31 @@ public class IssueStatusChartView
//
return result;
}
/**
* Builds the grouped.
*
* @param title
* the title
* @param project
* the project
* @return the string
* @throws AgirStatoolException
* the agir statool exception
*/
public static String buildGrouped(final String title, final Project project) throws AgirStatoolException
{
String result;
StringList labels = new StringList("Maybe", "Active", "Resolved");
StringList values = new StringList();
values.append(project.issueStats().getMaybeCount());
values.append(project.issueStats().getActiveCount());
values.append(project.issueStats().getResolvedCount());
result = build(title, title, labels, values);
//
return result;
}
}

View File

@ -58,7 +58,8 @@ public class ProjectPage
TagDataManager data = new TagDataManager();
data.setContent("agirLink", project.getName());
data.setContent("projectName", "Project " + project.getName());
data.setAttribute("projectName", "href", project.getPath());
data.setAttribute("agirLink", "href", "https://agir.april.org/projects/" + project.getIdentifier() + "/issues");
data.setContent("versionsup", BuildInformation.instance().version());

View File

@ -20,29 +20,28 @@ var myChart = new Chart(ctx,
type: 'line',
data:
{
labels: ['S01', 'S02', 'S03', 'S04', 'S05'],
datasets:
[
{
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,
pointBorderWidth: 0.00000001
pointBorderWidth: 0.00000001,
data: [2, 9, 13, 15, 22, 23]
},
{
label: 'Closedᴿ',
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,
pointBorderWidth: 0.00000001
pointBorderWidth: 0.00000001,
data: [1, 5, 9, 13, 15, 22]
}
]
},
@ -57,12 +56,25 @@ var myChart = new Chart(ctx,
{
xAxes:
[{
type: 'time',
time:
{
unit: 'month',
isoWeekday: true,
displayFormats:
{
month: 'YYYY MMM'
}
},
distribution: 'linear',
ticks:
{
beginAtZero: false
beginAtZero: false,
maxTicksLimit: 0
},
gridLines:
{
zeroLineColor: 'rgba(0, 0, 0, 0.1)',
offsetGridLines: false
}
}],

View File

@ -20,19 +20,18 @@ var myChart = new Chart(ctx,
type: 'line',
data:
{
labels: ['S01', 'S02', 'S03', 'S04', 'S05'],
datasets:
[
{
label: 'Active Issues',
data: [2, 9, 13, 15, 22, 23],
backgroundColor: 'rgba(255, 159, 64, 0.2)',
borderColor: 'rgba(255, 159, 64, 1)',
borderWidth: 1,
fill: true,
/* cubicInterpolationMode: 'monotone', */
lineTension: 0,
pointBorderWidth: 0.00000001
pointBorderWidth: 0.00000001,
data: [2, 9, 13, 15, 22, 23]
},
]
},
@ -47,9 +46,24 @@ var myChart = new Chart(ctx,
{
xAxes:
[{
type: 'time',
time:
{
unit: 'month',
isoWeekday: true,
displayFormats:
{
month: 'YYYY MMM'
}
},
distribution: 'linear',
ticks:
{
beginAtZero: false
},
gridLines:
{
zeroLineColor: 'rgba(0, 0, 0, 0.1)',
offsetGridLines: false
}
}],
yAxes:

View File

@ -20,41 +20,40 @@ var myChart = new Chart(ctx,
type: 'line',
data:
{
labels: ['S01', 'S02', 'S03', 'S04', 'S05'],
datasets:
[
{
label: 'min',
data: [2, 9, 13, 15, 22, 23],
backgroundColor: 'rgba(255, 99, 132, 0.2)',
borderColor: 'rgba(255, 99, 132, 1)',
borderWidth: 1,
fill: +1,
cubicInterpolationMode: 'monotone',
lineTension: 0,
pointBorderWidth: 0.00000001
pointBorderWidth: 0.00000001,
data: [2, 9, 13, 15, 22, 23],
},
{
label: 'mean',
data : [1, 5, 9, 13, 15, 22],
backgroundColor: 'rgba(75, 192, 192, 0.2)',
borderColor: 'rgba(75, 192, 192, 1)',
borderWidth: 1,
fill: +2,
cubicInterpolationMode: 'monotone',
lineTension: 0,
pointBorderWidth: 0.00000001
pointBorderWidth: 0.00000001,
data : [1, 5, 9, 13, 15, 22],
},
{
label: 'max',
data : [1, 5, 9, 13, 15, 22],
backgroundColor: 'rgba(153, 102, 255, 0.2)',
borderColor: 'rgba(153, 102, 255, 1)',
borderWidth: 1,
fill: false,
cubicInterpolationMode: 'monotone',
lineTension: 0,
pointBorderWidth: 0.00000001
pointBorderWidth: 0.00000001,
data : [1, 5, 9, 13, 15, 22],
}
]
},
@ -69,9 +68,26 @@ var myChart = new Chart(ctx,
{
xAxes:
[{
type: 'time',
time:
{
unit: 'month',
isoWeekday: true,
displayFormats:
{
month: 'YYYY MMM'
}
},
distribution: 'linear',
ticks:
{
beginAtZero: false
beginAtZero: false,
maxTicksLimit: 0
},
gridLines:
{
zeroLineColor: 'rgba(0, 0, 0, 0.1)',
offsetGridLines: false
}
}],
yAxes:

View File

@ -12,7 +12,7 @@
</head>
<body>
<div style="margin: 5px 10px 10px 10px;">
<h1><a href="index.xhtml">Agir Statool</a><sup id="versionsup" style="font-size: 9px;">v0.0.14</sup> Project <a id="agirLink" href="#">n/a</a></h1>
<h1><a href="index.xhtml">Agir Statool</a><sup id="versionsup" style="font-size: 9px;">v0.0.14</sup> <a id="projectName" href="#">n/a</a> <a id="agirLink" href="#">Link to Agir</a></h1>
<div id="mainCharts">
<div style="margin: 5px;">
<a id="createClose3MonthsButton" href="#" class="button" onclick="javascript:createClosedSelect('3months');">3 months</a>