ajout de la moyenne
This commit is contained in:
@@ -8,9 +8,8 @@
|
|||||||
|
|
||||||
<c:choose>
|
<c:choose>
|
||||||
<c:when test="${(empty listReport) and ( empty rpt) }">
|
<c:when test="${(empty listReport) and ( empty rpt) }">
|
||||||
<div class="warningBox">
|
<div class="warningBox">There is no report for this article at
|
||||||
There is no report for this article at the moment.
|
the moment.</div>
|
||||||
</div>
|
|
||||||
</c:when>
|
</c:when>
|
||||||
|
|
||||||
<c:otherwise>
|
<c:otherwise>
|
||||||
@@ -44,6 +43,21 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
</c:forEach>
|
</c:forEach>
|
||||||
|
|
||||||
|
|
||||||
|
<authz:authorize ifAllGranted="ROLE_CHAIRMAN">
|
||||||
|
<table>
|
||||||
|
<c:set var="OneRatings" value="${container[0]}" />
|
||||||
|
<c:forEach items="${OneRatings}" var="rating" varStatus="i">
|
||||||
|
<tr>
|
||||||
|
<td>The average for ${rating.criterion.name} is
|
||||||
|
${listMoyenne[i.index]}</td>
|
||||||
|
</tr>
|
||||||
|
</c:forEach>
|
||||||
|
|
||||||
|
</table>
|
||||||
|
</authz:authorize>
|
||||||
|
|
||||||
</c:when>
|
</c:when>
|
||||||
<c:otherwise>
|
<c:otherwise>
|
||||||
|
|
||||||
@@ -81,7 +95,8 @@
|
|||||||
</c:choose>
|
</c:choose>
|
||||||
|
|
||||||
<br />
|
<br />
|
||||||
<a class="back_link" href="<c:url value="${whereIcome}"/>"><fmt:message key="form.link.back" /></a>
|
<a class="back_link" href="<c:url value="${whereIcome}"/>"><fmt:message
|
||||||
|
key="form.link.back" /></a>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -86,11 +86,38 @@ public class ListReportController extends SimpleFormController {
|
|||||||
|
|
||||||
List<List<Rating>> container = new ArrayList<List<Rating>>();
|
List<List<Rating>> container = new ArrayList<List<Rating>>();
|
||||||
|
|
||||||
|
List<Double> listMoyenne = new ArrayList<Double>();
|
||||||
|
|
||||||
|
|
||||||
|
List<Rating> ratings = new ArrayList<Rating>();
|
||||||
for (int i = 0; i <= listReport.size() - 1; i++) {
|
for (int i = 0; i <= listReport.size() - 1; i++) {
|
||||||
List<Rating> ratings = evaluationManager.getRatingForReport(listReport.get(i).getId());
|
ratings = evaluationManager.getRatingForReport(listReport.get(i).getId());
|
||||||
container.add(ratings);
|
container.add(ratings);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//init liste moyenne
|
||||||
|
|
||||||
|
for (int j=0; j < ratings.size(); j++)
|
||||||
|
listMoyenne.add(new Double(0));
|
||||||
|
|
||||||
|
double sum = 0;
|
||||||
|
int i = 0;
|
||||||
|
for (List<Rating> listRt : container) {
|
||||||
|
for (Rating r : listRt) {
|
||||||
|
sum = listMoyenne.get(i);
|
||||||
|
sum += r.getValue();
|
||||||
|
listMoyenne.set(i, sum);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
i=0;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int j=0; j < ratings.size(); j++) {
|
||||||
|
listMoyenne.set(j, listMoyenne.get(j) / new Double(listReport.size()));
|
||||||
|
}
|
||||||
|
|
||||||
model.put("container", container);
|
model.put("container", container);
|
||||||
|
model.put("listMoyenne", listMoyenne);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -136,13 +163,18 @@ public class ListReportController extends SimpleFormController {
|
|||||||
|
|
||||||
model.put("whereIcome", request.getHeader("REFERER"));
|
model.put("whereIcome", request.getHeader("REFERER"));
|
||||||
|
|
||||||
/* double[] moyennes=new double[listReport.size()];
|
|
||||||
|
|
||||||
for (Rating rt : ratings)
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
}*/
|
listReport = evaluationManager.getReportsForArticle(id);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return new ModelAndView("listReport", model);
|
return new ModelAndView("listReport", model);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user