branch feature/5923 updated (34567cf -> 3c6b59f)
This is an automated email from the git hooks/post-receive script. New change to branch feature/5923 in repository wao. See http://git.codelutin.com/wao.git from 34567cf Dans la synthèse, on modifie le TemplateMethod pour pouvoir permettre de préciser un réalisé sur plusieurs mois new bed195a Récupération via cherry-pick, dans WaoUtils, de la méthode permettant de déduire le mois sur lequel compter le contact ObsMer new 3c6b59f Dans la synthèse, on compte désormais l'observation sur le mois avec le plus de jours de mer The 2 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Detailed log of new commits: commit 3c6b59f378f6bf90aa49835b838ad7cdeb216343 Author: Brendan Le Ny <bleny@codelutin.com> Date: Thu Feb 26 14:20:32 2015 +0100 Dans la synthèse, on compte désormais l'observation sur le mois avec le plus de jours de mer commit bed195a8206703ebefe63cdf52eb66d1557a1caf Author: Brendan Le Ny <bleny@codelutin.com> Date: Thu Feb 26 14:17:28 2015 +0100 Récupération via cherry-pick, dans WaoUtils, de la méthode permettant de déduire le mois sur lequel compter le contact ObsMer Summary of changes: .../src/main/java/fr/ifremer/wao/WaoUtils.java | 17 +++++++++++++++++ .../ifremer/wao/services/service/SynthesisService.java | 8 +++++++- 2 files changed, 24 insertions(+), 1 deletion(-) -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
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 bed195a8206703ebefe63cdf52eb66d1557a1caf Author: Brendan Le Ny <bleny@codelutin.com> Date: Thu Feb 26 14:17:28 2015 +0100 Récupération via cherry-pick, dans WaoUtils, de la méthode permettant de déduire le mois sur lequel compter le contact ObsMer --- .../src/main/java/fr/ifremer/wao/WaoUtils.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/wao-persistence/src/main/java/fr/ifremer/wao/WaoUtils.java b/wao-persistence/src/main/java/fr/ifremer/wao/WaoUtils.java index 0f6a1ce..0c1ebfd 100644 --- a/wao-persistence/src/main/java/fr/ifremer/wao/WaoUtils.java +++ b/wao-persistence/src/main/java/fr/ifremer/wao/WaoUtils.java @@ -274,4 +274,21 @@ public class WaoUtils { } }; } + + /** + * Retourne la clé qui a la plus grande valeur, en présences des valeurs égales, on privilégie + * les premières clés trouvées. + */ + public static <T> T getKeyWithHighestValue(Map<T, Integer> map) { + T keyWithHighestValue = null; + int maxObservationDays = 0; + for (Map.Entry<T, Integer> entry : map.entrySet()) { + T aKey = entry.getKey(); + Integer aObservationDays = entry.getValue(); + if (aObservationDays > maxObservationDays) { + keyWithHighestValue = aKey; + } + } + return keyWithHighestValue; + } } -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
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 3c6b59f378f6bf90aa49835b838ad7cdeb216343 Author: Brendan Le Ny <bleny@codelutin.com> Date: Thu Feb 26 14:20:32 2015 +0100 Dans la synthèse, on compte désormais l'observation sur le mois avec le plus de jours de mer --- .../java/fr/ifremer/wao/services/service/SynthesisService.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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 20b426f..4596c1e 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 @@ -619,7 +619,13 @@ public class SynthesisService extends WaoServiceSupport { */ @Override protected Map<Date, Integer> getActualPerPeriods(Contact contact) { - Date month = truncateToTimePeriod(contact.getObservationBeginDate()); + // on calcule les jours de mers pour chaque mois + Map<Date, Integer> observationDaysByMonthsForObservation = + WaoUtils.getObservationDaysByMonths( + contact.getObservationBeginDate(), + contact.getObservationEndDate()); + // on prend le mois avec le plus de jours de mers pour compter 1 observation + Date month = WaoUtils.getKeyWithHighestValue(observationDaysByMonthsForObservation); return ImmutableMap.of(month, 1); } } -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
participants (1)
-
codelutin.com scm