This is an automated email from the git hooks/post-receive script. New commit to branch feature/5923 in repository wao. See http://git.codelutin.com/wao.git commit 5f70e8a69a94f1e9a8db876616e57031cb3b2477 Author: Brendan Le Ny <bleny@codelutin.com> Date: Thu Feb 26 15:16:14 2015 +0100 Correction d'un bogue dans le calcul du réalisé dans les synthèses --- .../wao/services/service/SynthesisService.java | 35 ++++++++++------------ 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/wao-services/src/main/java/fr/ifremer/wao/services/service/SynthesisService.java b/wao-services/src/main/java/fr/ifremer/wao/services/service/SynthesisService.java index 4596c1e..b31e032 100644 --- a/wao-services/src/main/java/fr/ifremer/wao/services/service/SynthesisService.java +++ b/wao-services/src/main/java/fr/ifremer/wao/services/service/SynthesisService.java @@ -485,13 +485,11 @@ public class SynthesisService extends WaoServiceSupport { for (SampleMonth sampleMonth : sampleRow.getSampleMonth()) { Date month = sampleMonth.getPeriodDate(); Date period = truncateToTimePeriod(month); - if (periodRange.contains(period)) { - Integer expected = MoreObjects.firstNonNull( - expectedEffortByPeriods.get(period), - 0); - expected += getExpected(sampleMonth); - expectedEffortByPeriods.put(period, expected); - } + Integer expected = MoreObjects.firstNonNull( + expectedEffortByPeriods.get(period), + 0); + expected += getExpected(sampleMonth); + expectedEffortByPeriods.put(period, expected); } } @@ -504,13 +502,6 @@ public class SynthesisService extends WaoServiceSupport { for (Contact contact : contacts) { Preconditions.checkState(sampleRows.contains(contact.getSampleRow())); Map<Date, Integer> actualPerPeriods = getActualPerPeriods(contact); - for (Map.Entry<Date, Integer> entry : actualPerPeriods.entrySet()) { - Date period = entry.getKey(); - if (periodRange.contains(period)) { - Integer actual = entry.getValue(); - actualObservationsByPeriods.put(period, actual); - } - } actualObservationsByPeriods.putAll(Multimaps.forMap(actualPerPeriods)); } @@ -521,22 +512,28 @@ public class SynthesisService extends WaoServiceSupport { // Création du graphique DefaultCategoryDataset dataset = new DefaultCategoryDataset(); + // pour la barre représentant le planifié for (Map.Entry<Date, Integer> entry : expectedEffortByPeriods.entrySet()) { Date period = entry.getKey(); - Integer expected = entry.getValue(); - dataset.setValue(expected, I18n.l(locale, "wao.synthesis.planned"), formatPeriod(period)); + if (periodRange.contains(period)) { + Integer expected = entry.getValue(); + dataset.setValue(expected, I18n.l(locale, "wao.synthesis.planned"), formatPeriod(period)); + } } + + // pour la barre représentant l'estimé ou le réel String rowKey; if (realVsEstimated) { rowKey = I18n.l(locale, "wao.ui.samplingPlan.Actual"); } else { rowKey = I18n.l(locale, "wao.synthesis.estimated"); } - for (Map.Entry<Date, Collection<Integer>> entry : actualObservationsByPeriods.asMap().entrySet()) { Date period = entry.getKey(); - Integer actual = WaoUtils.sum(entry.getValue()); - dataset.setValue(actual, rowKey, formatPeriod(period)); + if (periodRange.contains(period)) { + Integer actual = WaoUtils.sum(entry.getValue()); + dataset.setValue(actual, rowKey, formatPeriod(period)); + } } // Axises -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.