Compare commits
7 Commits
Author | SHA1 | Date | |
---|---|---|---|
62b95f1ccf | |||
43a21307d3 | |||
349a378f46 | |||
c4d466bf54 | |||
10bc11baf4 | |||
4c28fe2dc7 | |||
292b33d126 |
|
@ -1,3 +1,3 @@
|
|||
#Build Number for ANT. Do not edit!
|
||||
#Wed Jan 06 17:33:09 CET 2021
|
||||
build.number=2
|
||||
#Sat May 08 22:44:18 CEST 2021
|
||||
build.number=5
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
{
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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.
|
||||
*
|
||||
|
|
76
src/org/april/agirstatool/core/LongList.java
Normal file
76
src/org/april/agirstatool/core/LongList.java
Normal 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);
|
||||
}
|
||||
}
|
|
@ -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
|
||||
|
|
|
@ -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:
|
||||
{
|
||||
|
|
|
@ -81,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">
|
||||
|
|
Loading…
Reference in New Issue
Block a user