branch feature/8204 updated (14f33e2 -> fb7af9a)
This is an automated email from the git hooks/post-receive script. New change to branch feature/8204 in repository tutti. See https://gitlab.nuiton.org/codelutin/tutti.git from 14f33e2 Add more logs + display error if code is not available (Fixes #8204) new fb7af9a On decremente uniquement si le code matché est le plus haut + amélioration code The 1 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 fb7af9a88a38c6192bc2187f7064447081790817 Author: Tony CHEMIT <chemit@codelutin.com> Date: Mon Apr 4 15:45:53 2016 +0200 On decremente uniquement si le code matché est le plus haut + amélioration code Summary of changes: .../tutti/service/sampling/CruiseSamplingCache.java | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) -- 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/8204 in repository tutti. See https://gitlab.nuiton.org/codelutin/tutti.git commit fb7af9a88a38c6192bc2187f7064447081790817 Author: Tony CHEMIT <chemit@codelutin.com> Date: Mon Apr 4 15:45:53 2016 +0200 On decremente uniquement si le code matché est le plus haut + amélioration code --- .../tutti/service/sampling/CruiseSamplingCache.java | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/tutti-service/src/main/java/fr/ifremer/tutti/service/sampling/CruiseSamplingCache.java b/tutti-service/src/main/java/fr/ifremer/tutti/service/sampling/CruiseSamplingCache.java index cfb80f0..c2a25e2 100644 --- a/tutti-service/src/main/java/fr/ifremer/tutti/service/sampling/CruiseSamplingCache.java +++ b/tutti-service/src/main/java/fr/ifremer/tutti/service/sampling/CruiseSamplingCache.java @@ -355,7 +355,7 @@ public class CruiseSamplingCache implements Closeable { * @param gender le sexe de l'échantillon (peut-être null) * @param maturity la maturité de l'échantillon (peut-être null) * @param lengthStep la classe de taille de l'échantillon (en mm) - * @param samplingCode le code de prélèvement ajouté + * @param samplingCode le code de prélèvement ajouté */ public void addSampling(Integer fishingOperationId, Optional<Zone> optionalZone, @@ -593,8 +593,7 @@ public class CruiseSamplingCache implements Closeable { int operationSamplingNb = operationCache.decrementSamplingNb(operationKey); - removeSamplingCode(species.getReferenceTaxonId()); -// removeSamplingCode(species.getReferenceTaxonId(), samplingCode); + removeSamplingCode(species.getReferenceTaxonId(), samplingCode); if (log.isInfoEnabled()) { log.info("remove Sampling " + samplingKey + " => op " + operationSamplingNb + " / zone " + zoneSamplingNb + " / cruise " + totalSamplingNb); @@ -740,7 +739,7 @@ public class CruiseSamplingCache implements Closeable { // return highestSamplingCodeBySpecies.getOrDefault(speciesId, 0) + 1; } - public int addSamplingCode(Integer speciesId, String samplingCode) { + protected int addSamplingCode(Integer speciesId, String samplingCode) { String[] codeParts = samplingCode.split("#"); Integer code = Integer.parseInt(codeParts[codeParts.length - 1]); @@ -749,13 +748,13 @@ public class CruiseSamplingCache implements Closeable { // (key, highestSamplingCode) -> highestSamplingCode == null ? code : Math.max(highestSamplingCode, code)); MutableInt samplingCodeFound = highestSamplingCodeBySpecies.get(speciesId); - if (samplingCodeFound==null) { + if (samplingCodeFound == null) { samplingCodeFound = new MutableInt(code); highestSamplingCodeBySpecies.put(speciesId, samplingCodeFound); } else { samplingCodeFound.setValue(Math.max(samplingCodeFound.intValue(), code)); } - return samplingCodeFound.intValue(); + return samplingCodeFound.intValue(); // Ce code ne compile pas. // return highestSamplingCodeBySpecies.compute(speciesId, // (key, highestSamplingCode) -> { @@ -770,14 +769,12 @@ public class CruiseSamplingCache implements Closeable { } - public void removeSamplingCode(Integer speciesId) { -// public void removeSamplingCode(Integer speciesId, String samplingCode) { -// String[] codeParts = samplingCode.split("#"); -// Integer code = Integer.parseInt(codeParts[codeParts.length - 1]); + protected void removeSamplingCode(Integer speciesId, String samplingCode) { + int code = SamplingCodePrefix.extractSamplingCodeIdFromSamplingCode(samplingCode); // decrement the highest sampling code if it is this code MutableInt samplingCodeFound = highestSamplingCodeBySpecies.get(speciesId); - if (samplingCodeFound!=null) { + if (samplingCodeFound != null && code == samplingCodeFound.intValue()) { samplingCodeFound.decrement(); } // return highestSamplingCodeBySpecies.computeIfPresent(speciesId, -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
participants (1)
-
codelutin.com scm