Compare commits

...

11 Commits

11 changed files with 174 additions and 20 deletions

View File

@ -1,3 +1,3 @@
#Build Number for ANT. Do not edit!
#Sat Jan 02 01:20:52 CET 2021
build.number=1
#Sat May 08 22:44:18 CEST 2021
build.number=5

View File

@ -41,7 +41,7 @@ function build_snapshot
# Java version check.
javaVersionCheck=`javac -version 2>&1`
if [[ "$javaVersionCheck" =~ ^.*\ 1.11 ]]; then
if [[ "$javaVersionCheck" =~ ^.*\ 11\. ]]; then
echo "Java 11 version requirement..... OK"
let "okCount+=1"
else
@ -83,7 +83,7 @@ function build_local
# Java version check.
javaVersionCheck=`javac -version 2>&1`
if [[ "$javaVersionCheck" =~ ^.*\ 1.11 ]]; then
if [[ "$javaVersionCheck" =~ ^.*\ 11\. ]]; then
echo "Java 11 version requirement..... OK"
let "okCount+=1"
else
@ -125,7 +125,7 @@ function build_tagandpush
# Java version check.
javaVersionCheck=`javac -version 2>&1`
if [[ "$javaVersionCheck" =~ ^.*\ 1.11 ]]; then
if [[ "$javaVersionCheck" =~ ^.*\ 11\. ]]; then
echo "Java 11 version requirement..... OK"
let "okCount+=1"
else

Binary file not shown.

View File

@ -246,7 +246,7 @@ public class AgirStatool
* @throws AgirStatoolException
* the agir statool exception
*/
public Issues fetchIssue(final Project project) throws AgirStatoolException
public Issues fetchIssues(final Project project) throws AgirStatoolException
{
Issues result;
@ -896,7 +896,7 @@ public class AgirStatool
// Fill created and concluded issues history.
{
{
Issues issues = fetchIssue(result);
Issues issues = fetchIssues(result);
result.issues().addAll(issues);
}
{
@ -916,7 +916,7 @@ public class AgirStatool
if (project.hasIssue())
{
{
Issues issues = fetchIssue(project);
Issues issues = fetchIssues(project);
project.issues().addAll(issues);
}
{

View File

@ -113,7 +113,10 @@ public class AgirStatoolUtils
LocalDate date = AgirStatoolUtils.normaliseWeekDate(start);
while (date.isBefore(normalizedEnd) || date.isEqual(normalizedEnd))
{
String label = date.format(DateTimeFormatter.ISO_DATE);
// The normalized date is set to the first day of the week.
// The displayed date is set to the last day of the week. So
// plus 6.
String label = date.plusDays(6).format(DateTimeFormatter.ISO_DATE);
result.add(label);
date = date.plusWeeks(1);
}
@ -142,8 +145,8 @@ public class AgirStatoolUtils
if (start != null)
{
LocalDate date = AgirStatoolUtils.normaliseWeekDate(start);
LocalDate normalizedEnd = AgirStatoolUtils.normaliseWeekDate(end);
LocalDate date = normaliseWeekDate(start).plusDays(6);
LocalDate normalizedEnd = normaliseWeekDate(end).plusDays(6);
while (date.isBefore(normalizedEnd) || date.isEqual(normalizedEnd))
{
Stat stat = project.issues().extractActivedAt(date).computeStat(date);
@ -178,8 +181,8 @@ public class AgirStatoolUtils
if (start != null)
{
LocalDate date = AgirStatoolUtils.normaliseWeekDate(start);
LocalDate normalizedEnd = AgirStatoolUtils.normaliseWeekDate(end);
LocalDate date = normaliseWeekDate(start).plusDays(6);
LocalDate normalizedEnd = normaliseWeekDate(end).plusDays(6);
while (date.isBefore(normalizedEnd) || date.isEqual(normalizedEnd))
{
Stat stat = project.issues().extractActivedAt(date).computeStat(date);
@ -195,6 +198,42 @@ public class AgirStatoolUtils
return result;
}
/**
* Builds the week median ages.
*
* @param project
* the project
* @param start
* the start
* @param end
* the end
* @return the string list
*/
public static StringList buildWeekMedianAges(final Project project, final LocalDate start, final LocalDate end)
{
StringList result;
result = new StringList();
if (start != null)
{
LocalDate date = normaliseWeekDate(start).plusDays(6);
LocalDate normalizedEnd = normaliseWeekDate(end).plusDays(6);
while (date.isBefore(normalizedEnd) || date.isEqual(normalizedEnd))
{
double stat = project.issues().extractActivedAt(date).computeMedian(date);
result.add(String.valueOf(stat));
//
date = date.plusWeeks(1);
}
}
//
return result;
}
/**
* Builds the week min ages.
*
@ -214,8 +253,8 @@ public class AgirStatoolUtils
if (start != null)
{
LocalDate date = AgirStatoolUtils.normaliseWeekDate(start);
LocalDate normalizedEnd = AgirStatoolUtils.normaliseWeekDate(end);
LocalDate date = normaliseWeekDate(start).plusDays(6);
LocalDate normalizedEnd = normaliseWeekDate(end).plusDays(6);
while (date.isBefore(normalizedEnd) || date.isEqual(normalizedEnd))
{
Stat stat = project.issues().extractActivedAt(date).computeStat(date);

View File

@ -47,6 +47,30 @@ public class Issues extends ArrayList<Issue>
super(capacity);
}
/**
* Compute median.
*
* @param date
* the date
* @return the double
*/
public double computeMedian(final LocalDate date)
{
double result;
LongList values = new LongList();
for (Issue issue : this)
{
int age = issue.getAgeInDays(date);
values.add(Long.valueOf(age));
}
result = values.median();
//
return result;
}
/**
* Compute stat.
*

View File

@ -0,0 +1,76 @@
/*
* Copyright (C) 2021 Christian Pierre MOMON <christian.momon@devinsy.fr>
*
* This file is part of AgirStatool, simple key value database.
*
* AgirStatool is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* AgirStatool is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with AgirStatool. If not, see <http://www.gnu.org/licenses/>.
*/
package org.april.agirstatool.core;
import java.util.ArrayList;
import java.util.Collections;
/**
* The Class LongList.
*/
public class LongList extends ArrayList<Long>
{
private static final long serialVersionUID = 2724688980125113107L;
/**
* Instantiates a new stat.
*/
public LongList()
{
super();
}
/**
* Median.
*
* @return the double
*/
public double median()
{
double result;
sort();
if (this.isEmpty())
{
result = 0;
}
else if (this.size() % 2 == 0)
{
long a = get(this.size() / 2 - 1);
long b = get(this.size() / 2);
result = (a + b) / 2;
}
else
{
result = get(this.size() / 2);
}
//
return result;
}
/**
* Sort.
*/
public void sort()
{
Collections.sort(this);
}
}

View File

@ -78,6 +78,9 @@ public class IssueAgeChartView
values = AgirStatoolUtils.buildWeekMaxAges(project, start, end);
code = code.replaceAll("data : \\[.*\\]", "data: " + AgirStatoolUtils.toJSonNumbers(labels, values));
values = AgirStatoolUtils.buildWeekMedianAges(project, start, end);
code = code.replaceAll("data : \\[.*\\]", "data: " + AgirStatoolUtils.toJSonNumbers(labels, values));
result = code.toString();
}
else

View File

@ -38,12 +38,23 @@ var myChart = new Chart(ctx,
backgroundColor: 'rgba(75, 192, 192, 0.2)',
borderColor: 'rgba(75, 192, 192, 1)',
borderWidth: 1,
fill: +2,
fill: +3,
cubicInterpolationMode: 'monotone',
lineTension: 0,
pointBorderWidth: 0.00000001,
data : [1, 5, 9, 13, 15, 22],
},
{
label: 'median',
backgroundColor: 'rgba(54, 162, 235, 0.2)',
borderColor: 'rgba(54, 162, 235, 1)',
borderWidth: 1,
fill: false,
cubicInterpolationMode: 'monotone',
lineTension: 0,
pointBorderWidth: 0.00000001,
data : [1, 5, 9, 13, 15, 22],
},
{
label: 'max',
backgroundColor: 'rgba(153, 102, 255, 0.2)',
@ -55,7 +66,7 @@ var myChart = new Chart(ctx,
pointBorderWidth: 0.00000001,
data : [1, 5, 9, 13, 15, 22],
}
]
]
},
options:
{

View File

@ -22,12 +22,13 @@
<a id="createClosePrevious3YearButton" href="#" class="button" onclick="javascript:createClosedSelect('previous3Year');">Year - 3</a>
<a id="createClosePrevious2YearButton" href="#" class="button" onclick="javascript:createClosedSelect('previous2Year');">Year - 2</a>
<a id="createClosePreviousYearButton" href="#" class="button" onclick="javascript:createClosedSelect('previousYear');">Previous Year</a>
<span style="margin-left: 50px;"> </span>
<span style="margin-left: 25px;"> </span>
<a href="#rawgroupedswitch" class="button" title="Go down to the table below.">⇊ ⇊</a>
<span style="margin-left: 50px;"> </span>
<span style="margin-left: 25px;"> </span>
<a href="index.xhtml" class="button">Root</a>
<a href="admins.xhtml" class="button">Admins</a>
<a href="chapril.xhtml" class="button">Chapril</a>
<a href="gdtc.xhtml" class="button">gDTC</a>
</div>
<div id="3MonthsBox" style="display: none;">
<div id="createdClosed3MonthsChart" style="display: inline-block; width: 33%; height: 400px;">CREATED/CLOSED 3 MONTHS CHART</div>
@ -80,7 +81,7 @@
<div id="unassignedGroupedChart" style="width: 360px; height: 200px; display: none;"></div>
<div id="createdClosedChartMini" style="width: 220px; height: 200px; display: inline-block;">CREATED/CLOSED CHART MINI</div>
<div id="created-ClosedChartMini" style="width: 220px; height: 200px; display: inline-block;">CREATED-CLOSED CHART MINI</div>
<div id="ageChartMini" style="width: 250px; height: 200px; display: inline-block;">CREATED-CLOSED MONTHS CHART MINI</div>
<div id="ageChartMini" style="width: 220px; height: 200px; display: inline-block;">CREATED-CLOSED MONTHS CHART MINI</div>
</div>
<br/>
<div id="tableView">