Skip to content

Commit

Permalink
Merge pull request #190 from q-rapids/develop
Browse files Browse the repository at this point in the history
Release hot fix v1.6.1
  • Loading branch information
alejandravv committed Jan 29, 2021
2 parents ff0f835 + b9bd943 commit b870aac
Show file tree
Hide file tree
Showing 13 changed files with 139 additions and 23 deletions.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ apply plugin: 'jacoco'
apply plugin: 'org.asciidoctor.convert'

group = 'com.upc.gessi.qrapids'
version = '1.6'
version = '1.6.2'
sourceCompatibility = 1.8

war {
Expand Down Expand Up @@ -78,7 +78,7 @@ dependencies {
compile('org.elasticsearch.client:transport:5.6.3')
compile('org.elasticsearch:elasticsearch:5.6.3')
compile('org.elasticsearch.client:elasticsearch-rest-high-level-client:5.6.3')
compile files('libs/qrapids-qma-elastic-1.0.jar')
compile files('libs/qrapids-qma-elastic-1.1.jar')

//API QR Generator
compile files('libs/qrapids-qr_generator-0.2.jar')
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,7 @@ public List<DTODetailedStrategicIndicatorEvaluation> ForecastDSI(List<DTODetaile
buildFactorsForStrategicIndicator(dsi, factors, factorsNames);

for(Map.Entry<String, ArrayList<Integer>> m : factors.entrySet()) {
urlString.append("&factor=").append(URLEncoder.encode(m.getKey(), UTF_8));
urlString.append(FACTOR_QUERY).append(URLEncoder.encode(m.getKey(), UTF_8));
}
urlString.append(HOST_QUERY).append(URLEncoder.encode(connection.getIp(), UTF_8));
urlString.append(PORT_QUERY).append(URLEncoder.encode(String.valueOf(connection.getPort()), UTF_8));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.upc.gessi.qrapids.app.presentation.rest.dto;
/**
* @author Oriol M. Alexandra V.
* @author Oriol M.
*/

public class DTOAssessment {
Expand Down
68 changes: 64 additions & 4 deletions src/main/resources/static/js/app/app.services.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ app.controller('TablesCtrl', function($scope, $http) {
url : "../api/strategicIndicators/current?profile="+profileId
}).then(function mySuccess(response) {
response.data.forEach(function (strategicIndicator) {
strategicIndicator.warning = "";
var siDate = new Date(strategicIndicator.date);
var today = new Date();
today.setHours(0);
Expand Down Expand Up @@ -58,14 +59,28 @@ app.controller('TablesCtrl', function($scope, $http) {
}).then(function mySuccess(response) {
var data = [];
response.data.forEach(function (strategicIndicatorEval) {
strategicIndicatorEval.warning = "";
// "The assessment is X days old." warning have no sense for historical data
var mismatchDays = strategicIndicatorEval.mismatchDays;
if (mismatchDays > 0) {
strategicIndicatorEval.warning = "The assessment of the factors and the strategic \nindicator has a difference of " + mismatchDays + " days. \n";
}

var missingFactors = strategicIndicatorEval.missingFactors;
if (missingFactors.length > 0) {
var factors = missingFactors.length === 1 ? missingFactors[0] : [ missingFactors.slice(0, -1).join(", "), missingFactors[missingFactors.length - 1] ].join(" and ");
strategicIndicatorEval.warning += "The following factors were missing when \nthe strategic indicator was assessed: " + factors;
}

data.push({
id: strategicIndicatorEval.id,
name: strategicIndicatorEval.name,
date: strategicIndicatorEval.date,
description: strategicIndicatorEval.description,
value: strategicIndicatorEval.value_description,
categories: strategicIndicatorEval.categories_description,
rationale: strategicIndicatorEval.rationale
rationale: strategicIndicatorEval.rationale,
warning: strategicIndicatorEval.warning
});
});
$scope.data = data;
Expand Down Expand Up @@ -504,6 +519,7 @@ app.controller('TablesCtrl', function($scope, $http) {
};

//Warnings
strategicIndicator.warning = "";
var siDate = new Date(strategicIndicatorEval.date);
var today = new Date();
today.setHours(0);
Expand Down Expand Up @@ -589,6 +605,33 @@ app.controller('TablesCtrl', function($scope, $http) {
}).then(function mySuccess(response) {
var data = [];
response.data.forEach(function (factorEval) {

//Warnings
factorEval.warning = "";
var fDate = new Date(factorEval.date);
var today = new Date();
today.setHours(0);
today.setMinutes(0);
today.setSeconds(0);
var millisecondsInOneDay = 86400000;
var millisecondsBetweenAssessmentAndToday = today.getTime() - fDate.getTime();
var oldAssessment = millisecondsBetweenAssessmentAndToday > millisecondsInOneDay;
if (oldAssessment) {
var daysOld = Math.round(millisecondsBetweenAssessmentAndToday / millisecondsInOneDay);
factorEval.warning = "The " + factorEval.name + " assessment is " + daysOld + " days old. \n";
}

var mismatchDays = factorEval.mismatchDays;
if (mismatchDays > 0) {
factorEval.warning += "The assessment of the metrics and the " + factorEval.name + " factor has a difference of " + mismatchDays + " days. \n";
}

var missingMetrics = factorEval.missingMetrics;
if (missingMetrics.length > 0) {
var factors = missingMetrics.length === 1 ? missingMetrics[0] : [ missingMetrics.slice(0, -1).join(", "), missingMetrics[missingMetrics.length - 1] ].join(" and ");
factorEval.warning += "The following metrics were missing when \nthe " + factorEval.name + " factor was assessed: " + factors;
}

var id = getParameterByName('id');
if (id !== "") { // see concrete detailed factor
if (factorEval.id == id) {
Expand All @@ -600,7 +643,8 @@ app.controller('TablesCtrl', function($scope, $http) {
metricName: metric.name,
description: metric.description,
value: metric.value_description,
rationale: metric.rationale
rationale: metric.rationale,
warning: factorEval.warning
})
});
}
Expand All @@ -613,11 +657,13 @@ app.controller('TablesCtrl', function($scope, $http) {
metricName: metric.name,
description: metric.description,
value: metric.value_description,
rationale: metric.rationale
rationale: metric.rationale,
warning: factorEval.warning
})
});
}
});
//TODO
$scope.data = data;
$scope.sortType = 'factorName';
$scope.sortReverse = false;
Expand Down Expand Up @@ -810,6 +856,7 @@ app.controller('TablesCtrl', function($scope, $http) {
result = response.data[0].factors;
}
result.forEach(function (factor) {
factor.warning = "";
var qfDate = new Date(factor.date);
var today = new Date();
today.setHours(0);
Expand Down Expand Up @@ -862,13 +909,26 @@ app.controller('TablesCtrl', function($scope, $http) {
}
console.log(response.data);
result.forEach(function (factorEval) {
factorEval.warning = "";
// "The assessment is X days old." warning have no sense for historical data
var mismatchDays = factorEval.mismatchDays;
if (mismatchDays > 0) {
factorEval.warning = "The assessment of the metrics and the factors \n has a difference of " + mismatchDays + " days. \n";
}

var missingMetrics = factorEval.missingMetrics;
if (missingMetrics && missingMetrics.length > 0) {
var factors = missingMetrics.length === 1 ? missingMetrics[0] : [ missingMetrics.slice(0, -1).join(", "), missingMetrics[missingMetrics.length - 1] ].join(" and ");
factorEval.warning += "The following metrics were missing when \nthe factor was assessed: " + factors;
}
data.push({
id: factorEval.id,
date: factorEval.date,
name: factorEval.name,
description: factorEval.description,
value: factorEval.value_description,
rationale: factorEval.rationale
rationale: factorEval.rationale,
warning: factorEval.warning
})
});
$scope.data = data;
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/static/js/gaugeChartFactor.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ function drawChartFactors(factors, container, width, height, categories, chartHy
if (message !== "") {
message += "\n"
}
message += "The assessment of the factors and the strategic indicator has a difference of " + mismatchDays + " days.";
message += "The assessment of the factors and the metrics has a difference of " + mismatchDays + " days.";
}

var missingMetrics = factors[i].missingMetrics;
Expand Down
28 changes: 26 additions & 2 deletions src/main/resources/static/js/navScript.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ if (currentURL.search("/HistoricTable") !== -1) {
} else if (currentURL.search("/HistoricChart") !== -1) {
viewMode = "Chart";
time = "Historic";
} else if (currentURL.search("/DetailedStrategicIndicators/CurrentChartRadar") !== -1){
} else if (currentURL.search("/DetailedStrategicIndicators/CurrentChartRadar") !== -1){
viewMode = "Chart";
DSIRepresentationMode = "Radar";
time = "Current";
Expand Down Expand Up @@ -166,6 +166,12 @@ if (currentURL.search("/HistoricTable") !== -1) {
viewMode = "Chart";
DQFRepresentationMode = sessionStorage.getItem("DQFRepresentationMode");
time = "Current";
} else if (currentURL.search("/CurrentChart") !== -1) {
viewMode = "Chart";
// TODO decide if necessary
DQFRepresentationMode = sessionStorage.getItem("DQFRepresentationMode");
DSIRepresentationMode = sessionStorage.getItem("DSIRepresentationMode");
time = "Current";
}

if (currentURL.search("/QualityModelGraph") !== -1) {
Expand All @@ -181,6 +187,10 @@ sessionStorage.setItem("DQFRepresentationMode", DQFRepresentationMode);
sessionStorage.setItem("qmMode", qmMode);
sessionStorage.setItem("time", time);

console.log("AFTER store in sessionStorage");
console.log("time value: " + time);
console.log("viewMode value: " + viewMode);

// Highlighting the enabled options depending on the View Mode and Time options selected
$("#" + viewMode).css("background-color", "#ffc380");
if (currentURL.search("/DetailedStrategicIndicators/CurrentChart") !== -1) {
Expand Down Expand Up @@ -443,6 +453,14 @@ $("#LogoutProfileConfig").click(function () {


function menuNav (urlNav) {

console.log("IN menuNav: ");
console.log(urlNav);
console.log("time value: " + time);
console.log("viewMode value: " + viewMode);

console.log(location);

//add id and name to url if found
var id = getParameterByName('id');
if (id.length !== 0) {
Expand All @@ -460,7 +478,13 @@ function menuNav (urlNav) {
urlNav = urlNav + "&siid=" + siid;
}
}
location.href = urlNav;
if (location.href.includes("/DetailedQualityFactors") && urlNav == "CurrentChart") {
location.href = urlNav + DQFRepresentationMode;
} else if (location.href.includes("/DetailedStrategicIndicators") && urlNav == "CurrentChart") {
location.href = urlNav + DSIRepresentationMode;
} else {
location.href = urlNav;
}
}

function parseURLSimple(url) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/static/js/parseDataDetailedQFCurrent.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ function getData() {

var mismatchDays = data[i].mismatchDays;
if (mismatchDays > 0) {
var message = "The assessment of the factors and the strategic indicator has a difference of " + mismatchDays + " days.";
var message = "The assessment of the factors and the metrics has a difference of " + mismatchDays + " days.";
messages.push(message);
}

Expand Down
30 changes: 20 additions & 10 deletions src/main/resources/static/js/phases.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,49 +131,56 @@ function getData(phases) {

console.log("getData");
console.log(data);
console.log("phases");
console.log(phases);

if (data.length === 0) {
if (data.length === 0) { // when there is NO historical data for phases period
var siData = [];
addNoDataStrategicIndicators (phases, siData);
} else {
} else { // when there is historical data
var aux = [{cat: "No data", val:-1}];
var values = [];
var currentSI = data[0].name;
var currentSI = data[0].name; // take first SI from hist. data
var i = 0;
var currentPH = phases[i];
var currentPH = phases[i]; // take first phase as current phase
var siData = [data[0].name];
data.forEach(function (d) {
if (d.name == currentSI) {
data.forEach(function (d) { // for on historical data
if (d.name == currentSI) { // same SI
var out = false;
while (i < phases.length && !out) {
if (d.date < currentPH.to) {
if (d.date <= currentPH.to) {
aux.push({cat: d.value.second, val: d.value.first});
out = true;
} else {
var m = mode(aux);
values.push({x: currentPH.name, y: Math.round(100 * m.val)});
// change phase in same SI
i++;
currentPH = phases[i];
aux = [{cat: "No data", val:-1}];
}
}
} else {
// put current si values
var m = mode(aux);
values.push({x: currentPH.name, y: Math.round(100 * m.val)});
i++;
currentPH = phases[i];
aux = [{cat: "No data", val:-1}];
// put no data for future phases of current si
while (i < phases.length){
var m = mode(aux);
values.push({x: currentPH.name, y: Math.round(100 * m.val)});
i++;
currentPH = phases[i];
aux = [{cat: "No data", val:-1}];
}
// prepare heatmap series
s.push({
name: currentSI,
data: values
});
// change SI
currentSI = d.name;
siData.push(d.name);
aux = [{cat: "No data", val:-1}];
Expand All @@ -182,7 +189,7 @@ function getData(phases) {
currentPH = phases[i];
out = false;
while (i < phases.length && !out) {
if (d.date < currentPH.to) {
if (d.date <= currentPH.to) {
aux.push({cat: d.value.second, val: d.value.first});
out = true;
} else {
Expand All @@ -195,25 +202,28 @@ function getData(phases) {
}
}
});
// after for function on historical data
// put last phase with historical data values (last si)
var m = mode(aux);
values.push({x: currentPH.name, y: Math.round(100 * m.val)});
// change phase
i++;
currentPH = phases[i];
aux = [{cat: "No data", val:-1}];
// add no data values for future phases if there are (last si)
while (i < phases.length){
var m = mode(aux);
values.push({x: currentPH.name, y: Math.round(100 * m.val)});
i++;
currentPH = phases[i];
aux = [{cat: "No data", val:-1}];
}
// prepare heatmap series
s.push({
name: currentSI,
data: values
});
addNoDataStrategicIndicators(phases, siData);
console.log("new serie: ");
console.log(s);
drawHeatmap(phases);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@ <h1 id="title" align="center"></h1>
<span class="caret"></span>
</span>
</th>
<th ng-click="sortBy('warning')">Warning (Factor)
<span ng-show="sortType == 'warning' &amp;&amp; sortReverse" class="caret"></span>
<span ng-show="sortType == 'warning' &amp;&amp; !sortReverse" class="dropup">
<span class="caret"></span>
</span>
</th>
</tr>
</thead>
<tbody>
Expand All @@ -67,6 +73,7 @@ <h1 id="title" align="center"></h1>
<td>{{d.description}}</td>
<td>{{d.value}}</td>
<td>{{d.rationale}}</td>
<td style="white-space: pre;" id="warning">{{d.warning}}</td>
<tr ng-repeat-end="d in data"></tr>
</tbody>
</table>
Expand Down
3 changes: 2 additions & 1 deletion src/main/resources/templates/Phases/Phases.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
</div>
</body>
<th:block th:replace="Fragments/TemplateDashboard :: scriptsBasic"></th:block>
<script src="https://cdn.jsdelivr.net/npm/apexcharts@3.19.2"></script>
<!--script src="https://cdn.jsdelivr.net/npm/apexcharts@3.19.2"></script-->
<script type="text/javascript" th:src="@{/js/lib/apexcharts.min.js}"></script>
<script type="text/javascript" src="../../static/js/phases.js" th:src="@{/js/phases.js}"></script>
<script>
window.onload = function() {
Expand Down
Loading

0 comments on commit b870aac

Please sign in to comment.