Skip to content

Commit b870aac

Browse files
authored
Merge pull request #190 from q-rapids/develop
Release hot fix v1.6.1
2 parents ff0f835 + b9bd943 commit b870aac

File tree

13 files changed

+139
-23
lines changed

13 files changed

+139
-23
lines changed

build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ apply plugin: 'jacoco'
2626
apply plugin: 'org.asciidoctor.convert'
2727

2828
group = 'com.upc.gessi.qrapids'
29-
version = '1.6'
29+
version = '1.6.2'
3030
sourceCompatibility = 1.8
3131

3232
war {
@@ -78,7 +78,7 @@ dependencies {
7878
compile('org.elasticsearch.client:transport:5.6.3')
7979
compile('org.elasticsearch:elasticsearch:5.6.3')
8080
compile('org.elasticsearch.client:elasticsearch-rest-high-level-client:5.6.3')
81-
compile files('libs/qrapids-qma-elastic-1.0.jar')
81+
compile files('libs/qrapids-qma-elastic-1.1.jar')
8282

8383
//API QR Generator
8484
compile files('libs/qrapids-qr_generator-0.2.jar')
Binary file not shown.

src/main/java/com/upc/gessi/qrapids/app/domain/adapters/Forecast.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -546,7 +546,7 @@ public List<DTODetailedStrategicIndicatorEvaluation> ForecastDSI(List<DTODetaile
546546
buildFactorsForStrategicIndicator(dsi, factors, factorsNames);
547547

548548
for(Map.Entry<String, ArrayList<Integer>> m : factors.entrySet()) {
549-
urlString.append("&factor=").append(URLEncoder.encode(m.getKey(), UTF_8));
549+
urlString.append(FACTOR_QUERY).append(URLEncoder.encode(m.getKey(), UTF_8));
550550
}
551551
urlString.append(HOST_QUERY).append(URLEncoder.encode(connection.getIp(), UTF_8));
552552
urlString.append(PORT_QUERY).append(URLEncoder.encode(String.valueOf(connection.getPort()), UTF_8));

src/main/java/com/upc/gessi/qrapids/app/presentation/rest/dto/DTOAssessment.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package com.upc.gessi.qrapids.app.presentation.rest.dto;
22
/**
3-
* @author Oriol M. Alexandra V.
3+
* @author Oriol M.
44
*/
55

66
public class DTOAssessment {

src/main/resources/static/js/app/app.services.js

Lines changed: 64 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ app.controller('TablesCtrl', function($scope, $http) {
1515
url : "../api/strategicIndicators/current?profile="+profileId
1616
}).then(function mySuccess(response) {
1717
response.data.forEach(function (strategicIndicator) {
18+
strategicIndicator.warning = "";
1819
var siDate = new Date(strategicIndicator.date);
1920
var today = new Date();
2021
today.setHours(0);
@@ -58,14 +59,28 @@ app.controller('TablesCtrl', function($scope, $http) {
5859
}).then(function mySuccess(response) {
5960
var data = [];
6061
response.data.forEach(function (strategicIndicatorEval) {
62+
strategicIndicatorEval.warning = "";
63+
// "The assessment is X days old." warning have no sense for historical data
64+
var mismatchDays = strategicIndicatorEval.mismatchDays;
65+
if (mismatchDays > 0) {
66+
strategicIndicatorEval.warning = "The assessment of the factors and the strategic \nindicator has a difference of " + mismatchDays + " days. \n";
67+
}
68+
69+
var missingFactors = strategicIndicatorEval.missingFactors;
70+
if (missingFactors.length > 0) {
71+
var factors = missingFactors.length === 1 ? missingFactors[0] : [ missingFactors.slice(0, -1).join(", "), missingFactors[missingFactors.length - 1] ].join(" and ");
72+
strategicIndicatorEval.warning += "The following factors were missing when \nthe strategic indicator was assessed: " + factors;
73+
}
74+
6175
data.push({
6276
id: strategicIndicatorEval.id,
6377
name: strategicIndicatorEval.name,
6478
date: strategicIndicatorEval.date,
6579
description: strategicIndicatorEval.description,
6680
value: strategicIndicatorEval.value_description,
6781
categories: strategicIndicatorEval.categories_description,
68-
rationale: strategicIndicatorEval.rationale
82+
rationale: strategicIndicatorEval.rationale,
83+
warning: strategicIndicatorEval.warning
6984
});
7085
});
7186
$scope.data = data;
@@ -504,6 +519,7 @@ app.controller('TablesCtrl', function($scope, $http) {
504519
};
505520

506521
//Warnings
522+
strategicIndicator.warning = "";
507523
var siDate = new Date(strategicIndicatorEval.date);
508524
var today = new Date();
509525
today.setHours(0);
@@ -589,6 +605,33 @@ app.controller('TablesCtrl', function($scope, $http) {
589605
}).then(function mySuccess(response) {
590606
var data = [];
591607
response.data.forEach(function (factorEval) {
608+
609+
//Warnings
610+
factorEval.warning = "";
611+
var fDate = new Date(factorEval.date);
612+
var today = new Date();
613+
today.setHours(0);
614+
today.setMinutes(0);
615+
today.setSeconds(0);
616+
var millisecondsInOneDay = 86400000;
617+
var millisecondsBetweenAssessmentAndToday = today.getTime() - fDate.getTime();
618+
var oldAssessment = millisecondsBetweenAssessmentAndToday > millisecondsInOneDay;
619+
if (oldAssessment) {
620+
var daysOld = Math.round(millisecondsBetweenAssessmentAndToday / millisecondsInOneDay);
621+
factorEval.warning = "The " + factorEval.name + " assessment is " + daysOld + " days old. \n";
622+
}
623+
624+
var mismatchDays = factorEval.mismatchDays;
625+
if (mismatchDays > 0) {
626+
factorEval.warning += "The assessment of the metrics and the " + factorEval.name + " factor has a difference of " + mismatchDays + " days. \n";
627+
}
628+
629+
var missingMetrics = factorEval.missingMetrics;
630+
if (missingMetrics.length > 0) {
631+
var factors = missingMetrics.length === 1 ? missingMetrics[0] : [ missingMetrics.slice(0, -1).join(", "), missingMetrics[missingMetrics.length - 1] ].join(" and ");
632+
factorEval.warning += "The following metrics were missing when \nthe " + factorEval.name + " factor was assessed: " + factors;
633+
}
634+
592635
var id = getParameterByName('id');
593636
if (id !== "") { // see concrete detailed factor
594637
if (factorEval.id == id) {
@@ -600,7 +643,8 @@ app.controller('TablesCtrl', function($scope, $http) {
600643
metricName: metric.name,
601644
description: metric.description,
602645
value: metric.value_description,
603-
rationale: metric.rationale
646+
rationale: metric.rationale,
647+
warning: factorEval.warning
604648
})
605649
});
606650
}
@@ -613,11 +657,13 @@ app.controller('TablesCtrl', function($scope, $http) {
613657
metricName: metric.name,
614658
description: metric.description,
615659
value: metric.value_description,
616-
rationale: metric.rationale
660+
rationale: metric.rationale,
661+
warning: factorEval.warning
617662
})
618663
});
619664
}
620665
});
666+
//TODO
621667
$scope.data = data;
622668
$scope.sortType = 'factorName';
623669
$scope.sortReverse = false;
@@ -810,6 +856,7 @@ app.controller('TablesCtrl', function($scope, $http) {
810856
result = response.data[0].factors;
811857
}
812858
result.forEach(function (factor) {
859+
factor.warning = "";
813860
var qfDate = new Date(factor.date);
814861
var today = new Date();
815862
today.setHours(0);
@@ -862,13 +909,26 @@ app.controller('TablesCtrl', function($scope, $http) {
862909
}
863910
console.log(response.data);
864911
result.forEach(function (factorEval) {
912+
factorEval.warning = "";
913+
// "The assessment is X days old." warning have no sense for historical data
914+
var mismatchDays = factorEval.mismatchDays;
915+
if (mismatchDays > 0) {
916+
factorEval.warning = "The assessment of the metrics and the factors \n has a difference of " + mismatchDays + " days. \n";
917+
}
918+
919+
var missingMetrics = factorEval.missingMetrics;
920+
if (missingMetrics && missingMetrics.length > 0) {
921+
var factors = missingMetrics.length === 1 ? missingMetrics[0] : [ missingMetrics.slice(0, -1).join(", "), missingMetrics[missingMetrics.length - 1] ].join(" and ");
922+
factorEval.warning += "The following metrics were missing when \nthe factor was assessed: " + factors;
923+
}
865924
data.push({
866925
id: factorEval.id,
867926
date: factorEval.date,
868927
name: factorEval.name,
869928
description: factorEval.description,
870929
value: factorEval.value_description,
871-
rationale: factorEval.rationale
930+
rationale: factorEval.rationale,
931+
warning: factorEval.warning
872932
})
873933
});
874934
$scope.data = data;

src/main/resources/static/js/gaugeChartFactor.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ function drawChartFactors(factors, container, width, height, categories, chartHy
212212
if (message !== "") {
213213
message += "\n"
214214
}
215-
message += "The assessment of the factors and the strategic indicator has a difference of " + mismatchDays + " days.";
215+
message += "The assessment of the factors and the metrics has a difference of " + mismatchDays + " days.";
216216
}
217217

218218
var missingMetrics = factors[i].missingMetrics;

src/main/resources/static/js/navScript.js

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ if (currentURL.search("/HistoricTable") !== -1) {
134134
} else if (currentURL.search("/HistoricChart") !== -1) {
135135
viewMode = "Chart";
136136
time = "Historic";
137-
} else if (currentURL.search("/DetailedStrategicIndicators/CurrentChartRadar") !== -1){
137+
} else if (currentURL.search("/DetailedStrategicIndicators/CurrentChartRadar") !== -1){
138138
viewMode = "Chart";
139139
DSIRepresentationMode = "Radar";
140140
time = "Current";
@@ -166,6 +166,12 @@ if (currentURL.search("/HistoricTable") !== -1) {
166166
viewMode = "Chart";
167167
DQFRepresentationMode = sessionStorage.getItem("DQFRepresentationMode");
168168
time = "Current";
169+
} else if (currentURL.search("/CurrentChart") !== -1) {
170+
viewMode = "Chart";
171+
// TODO decide if necessary
172+
DQFRepresentationMode = sessionStorage.getItem("DQFRepresentationMode");
173+
DSIRepresentationMode = sessionStorage.getItem("DSIRepresentationMode");
174+
time = "Current";
169175
}
170176

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

190+
console.log("AFTER store in sessionStorage");
191+
console.log("time value: " + time);
192+
console.log("viewMode value: " + viewMode);
193+
184194
// Highlighting the enabled options depending on the View Mode and Time options selected
185195
$("#" + viewMode).css("background-color", "#ffc380");
186196
if (currentURL.search("/DetailedStrategicIndicators/CurrentChart") !== -1) {
@@ -443,6 +453,14 @@ $("#LogoutProfileConfig").click(function () {
443453

444454

445455
function menuNav (urlNav) {
456+
457+
console.log("IN menuNav: ");
458+
console.log(urlNav);
459+
console.log("time value: " + time);
460+
console.log("viewMode value: " + viewMode);
461+
462+
console.log(location);
463+
446464
//add id and name to url if found
447465
var id = getParameterByName('id');
448466
if (id.length !== 0) {
@@ -460,7 +478,13 @@ function menuNav (urlNav) {
460478
urlNav = urlNav + "&siid=" + siid;
461479
}
462480
}
463-
location.href = urlNav;
481+
if (location.href.includes("/DetailedQualityFactors") && urlNav == "CurrentChart") {
482+
location.href = urlNav + DQFRepresentationMode;
483+
} else if (location.href.includes("/DetailedStrategicIndicators") && urlNav == "CurrentChart") {
484+
location.href = urlNav + DSIRepresentationMode;
485+
} else {
486+
location.href = urlNav;
487+
}
464488
}
465489

466490
function parseURLSimple(url) {

src/main/resources/static/js/parseDataDetailedQFCurrent.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ function getData() {
7070

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

src/main/resources/static/js/phases.js

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -131,49 +131,56 @@ function getData(phases) {
131131

132132
console.log("getData");
133133
console.log(data);
134+
console.log("phases");
135+
console.log(phases);
134136

135-
if (data.length === 0) {
137+
if (data.length === 0) { // when there is NO historical data for phases period
136138
var siData = [];
137139
addNoDataStrategicIndicators (phases, siData);
138-
} else {
140+
} else { // when there is historical data
139141
var aux = [{cat: "No data", val:-1}];
140142
var values = [];
141-
var currentSI = data[0].name;
143+
var currentSI = data[0].name; // take first SI from hist. data
142144
var i = 0;
143-
var currentPH = phases[i];
145+
var currentPH = phases[i]; // take first phase as current phase
144146
var siData = [data[0].name];
145-
data.forEach(function (d) {
146-
if (d.name == currentSI) {
147+
data.forEach(function (d) { // for on historical data
148+
if (d.name == currentSI) { // same SI
147149
var out = false;
148150
while (i < phases.length && !out) {
149-
if (d.date < currentPH.to) {
151+
if (d.date <= currentPH.to) {
150152
aux.push({cat: d.value.second, val: d.value.first});
151153
out = true;
152154
} else {
153155
var m = mode(aux);
154156
values.push({x: currentPH.name, y: Math.round(100 * m.val)});
157+
// change phase in same SI
155158
i++;
156159
currentPH = phases[i];
157160
aux = [{cat: "No data", val:-1}];
158161
}
159162
}
160163
} else {
164+
// put current si values
161165
var m = mode(aux);
162166
values.push({x: currentPH.name, y: Math.round(100 * m.val)});
163167
i++;
164168
currentPH = phases[i];
165169
aux = [{cat: "No data", val:-1}];
170+
// put no data for future phases of current si
166171
while (i < phases.length){
167172
var m = mode(aux);
168173
values.push({x: currentPH.name, y: Math.round(100 * m.val)});
169174
i++;
170175
currentPH = phases[i];
171176
aux = [{cat: "No data", val:-1}];
172177
}
178+
// prepare heatmap series
173179
s.push({
174180
name: currentSI,
175181
data: values
176182
});
183+
// change SI
177184
currentSI = d.name;
178185
siData.push(d.name);
179186
aux = [{cat: "No data", val:-1}];
@@ -182,7 +189,7 @@ function getData(phases) {
182189
currentPH = phases[i];
183190
out = false;
184191
while (i < phases.length && !out) {
185-
if (d.date < currentPH.to) {
192+
if (d.date <= currentPH.to) {
186193
aux.push({cat: d.value.second, val: d.value.first});
187194
out = true;
188195
} else {
@@ -195,25 +202,28 @@ function getData(phases) {
195202
}
196203
}
197204
});
205+
// after for function on historical data
206+
// put last phase with historical data values (last si)
198207
var m = mode(aux);
199208
values.push({x: currentPH.name, y: Math.round(100 * m.val)});
209+
// change phase
200210
i++;
201211
currentPH = phases[i];
202212
aux = [{cat: "No data", val:-1}];
213+
// add no data values for future phases if there are (last si)
203214
while (i < phases.length){
204215
var m = mode(aux);
205216
values.push({x: currentPH.name, y: Math.round(100 * m.val)});
206217
i++;
207218
currentPH = phases[i];
208219
aux = [{cat: "No data", val:-1}];
209220
}
221+
// prepare heatmap series
210222
s.push({
211223
name: currentSI,
212224
data: values
213225
});
214226
addNoDataStrategicIndicators(phases, siData);
215-
console.log("new serie: ");
216-
console.log(s);
217227
drawHeatmap(phases);
218228
}
219229
}

src/main/resources/templates/DetailedQualityFactors/CurrentTable.html

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,12 @@ <h1 id="title" align="center"></h1>
5757
<span class="caret"></span>
5858
</span>
5959
</th>
60+
<th ng-click="sortBy('warning')">Warning (Factor)
61+
<span ng-show="sortType == 'warning' &amp;&amp; sortReverse" class="caret"></span>
62+
<span ng-show="sortType == 'warning' &amp;&amp; !sortReverse" class="dropup">
63+
<span class="caret"></span>
64+
</span>
65+
</th>
6066
</tr>
6167
</thead>
6268
<tbody>
@@ -67,6 +73,7 @@ <h1 id="title" align="center"></h1>
6773
<td>{{d.description}}</td>
6874
<td>{{d.value}}</td>
6975
<td>{{d.rationale}}</td>
76+
<td style="white-space: pre;" id="warning">{{d.warning}}</td>
7077
<tr ng-repeat-end="d in data"></tr>
7178
</tbody>
7279
</table>

0 commit comments

Comments
 (0)