[tutti] branch develop updated (bb534b2 -> d465ced)
This is an automated email from the git hooks/post-receive script. New change to branch develop in repository tutti. See http://git.codelutin.com/tutti.git from bb534b2 remove unused method new fcf6589 clean code new d465ced fixes #5698: [CAPTURE] ne garde plus le poids sous échantillon après élévation des poids 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 d465cedc7b4abcd9d80b93ec80e28ffb9b7538be Author: Tony CHEMIT <chemit@codelutin.com> Date: Fri Aug 29 16:04:51 2014 +0200 fixes #5698: [CAPTURE] ne garde plus le poids sous échantillon après élévation des poids commit fcf6589e9f43c09b38bfd56a1b8de39dfa248478 Author: Tony CHEMIT <chemit@codelutin.com> Date: Fri Aug 29 16:04:32 2014 +0200 clean code Summary of changes: .../SpeciesBatchPersistenceServiceImpl.java | 42 +++++++++++++++++----- .../service/catches/WeightComputingService.java | 12 +++---- 2 files changed, 39 insertions(+), 15 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 develop in repository tutti. See http://git.codelutin.com/tutti.git commit fcf6589e9f43c09b38bfd56a1b8de39dfa248478 Author: Tony CHEMIT <chemit@codelutin.com> Date: Fri Aug 29 16:04:32 2014 +0200 clean code --- .../tutti/service/catches/WeightComputingService.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tutti-service/src/main/java/fr/ifremer/tutti/service/catches/WeightComputingService.java b/tutti-service/src/main/java/fr/ifremer/tutti/service/catches/WeightComputingService.java index 09ad3c7..8ff4542 100644 --- a/tutti-service/src/main/java/fr/ifremer/tutti/service/catches/WeightComputingService.java +++ b/tutti-service/src/main/java/fr/ifremer/tutti/service/catches/WeightComputingService.java @@ -185,8 +185,8 @@ public class WeightComputingService extends AbstractTuttiService { Float speciesTotalComputedUnsortedWeight = 0f; if (rootSpeciesBatch != null) { - for (int i = 0; i < rootSpeciesBatch.getChildren().size(); i++) { - SpeciesBatch row = rootSpeciesBatch.getChildren().get(i); + List<SpeciesBatch> speciesBatches = rootSpeciesBatch.getChildren(); + for (SpeciesBatch row : speciesBatches) { Float weight = Numbers.getValueOrComputedValue( row.getSampleCategoryWeight(), row.getSampleCategoryComputedWeight()); @@ -242,8 +242,8 @@ public class WeightComputingService extends AbstractTuttiService { Float benthosTotalComputedUnsortedWeight = 0f; if (rootBenthosBatch != null) { - for (int i = 0; i < rootBenthosBatch.getChildren().size(); i++) { - BenthosBatch row = rootBenthosBatch.getChildren().get(i); + List<BenthosBatch> benthosBatches = rootBenthosBatch.getChildren(); + for (BenthosBatch row : benthosBatches) { Float weight = Numbers.getValueOrComputedValue( row.getSampleCategoryWeight(), row.getSampleCategoryComputedWeight()); @@ -299,8 +299,8 @@ public class WeightComputingService extends AbstractTuttiService { Float marineLitterTotalComputedWeight = 0f; if (rootMarineLitterBatch != null) { - for (int i = 0; i < rootMarineLitterBatch.getChildren().size(); i++) { - MarineLitterBatch row = rootMarineLitterBatch.getChildren().get(i); + List<MarineLitterBatch> marineLitterBatches = rootMarineLitterBatch.getChildren(); + for (MarineLitterBatch row : marineLitterBatches) { Float rowWeight = row.getWeight(); if (rowWeight == null) { marineLitterTotalComputedWeight = null; -- 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 develop in repository tutti. See http://git.codelutin.com/tutti.git commit d465cedc7b4abcd9d80b93ec80e28ffb9b7538be Author: Tony CHEMIT <chemit@codelutin.com> Date: Fri Aug 29 16:04:51 2014 +0200 fixes #5698: [CAPTURE] ne garde plus le poids sous échantillon après élévation des poids --- .../SpeciesBatchPersistenceServiceImpl.java | 42 +++++++++++++++++----- 1 file changed, 33 insertions(+), 9 deletions(-) diff --git a/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/SpeciesBatchPersistenceServiceImpl.java b/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/SpeciesBatchPersistenceServiceImpl.java index 413c312..32b095e 100644 --- a/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/SpeciesBatchPersistenceServiceImpl.java +++ b/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/SpeciesBatchPersistenceServiceImpl.java @@ -24,6 +24,7 @@ package fr.ifremer.tutti.persistence.service; import com.google.common.base.Preconditions; import com.google.common.collect.ArrayListMultimap; +import com.google.common.collect.Iterables; import com.google.common.collect.Lists; import com.google.common.collect.Multimap; import fr.ifremer.adagio.core.dao.data.batch.Batch; @@ -128,7 +129,7 @@ public class SpeciesBatchPersistenceServiceImpl extends AbstractPersistenceServi Species species = referentialService.getSpeciesByReferenceTaxonId(referenceTaxon.getId()); if (species == null) { FishingOperation fishingOperation = fishingOperationPersistenceService.getFishingOperation(fishingOperationId); - String fishingOperationName = fishingOperation.getStationNumber() + " - " + fishingOperation.getFishingOperationNumber() + " - " + df .format(fishingOperation.getGearShootingStartDate()); + String fishingOperationName = fishingOperation.getStationNumber() + " - " + fishingOperation.getFishingOperationNumber() + " - " + df.format(fishingOperation.getGearShootingStartDate()); throw new InvalidBatchModelException(t("tutti.persistence.speciesBatch.validation.unkonwn.taxon", fishingOperationName, source.getId(), referenceTaxon.getId())); } SpeciesBatch target = SpeciesBatchs.newSpeciesBatch(); @@ -158,7 +159,7 @@ public class SpeciesBatchPersistenceServiceImpl extends AbstractPersistenceServi if (species == null) { FishingOperation fishingOperation = fishingOperationPersistenceService.getFishingOperation(fishingOperationId); String fishingOperationName = fishingOperation.getStationNumber() + " - " + fishingOperation.getFishingOperationNumber() + " - " + df.format(fishingOperation.getGearShootingStartDate()); - throw new InvalidBatchModelException(t("tutti.persistence.speciesBatch.validation.unkonwn.taxon", fishingOperationName , source.getId(), referenceTaxon.getId())); + throw new InvalidBatchModelException(t("tutti.persistence.speciesBatch.validation.unkonwn.taxon", fishingOperationName, source.getId(), referenceTaxon.getId())); } SpeciesBatch target = SpeciesBatchs.newSpeciesBatch(); target.setSpecies(species); @@ -414,13 +415,13 @@ public class SpeciesBatchPersistenceServiceImpl extends AbstractPersistenceServi target.setSampleCategoryWeight(source.getWeightBeforeSampling()); } - if (CollectionUtils.isNotEmpty(source.getChildBatchs()) && target.getWeight() != null) { - - // can't use this sample weight on a node - // the weight comes from sampleRatioText, but must NOT be used here - target.setWeight(null); - - } +// if (CollectionUtils.isNotEmpty(source.getChildBatchs()) && target.getWeight() != null) { +// +// // can't use this sample weight on a node +// // the weight comes from sampleRatioText, but must NOT be used here +// target.setWeight(null); +// +// } // Comments @@ -469,6 +470,29 @@ public class SpeciesBatchPersistenceServiceImpl extends AbstractPersistenceServi target.setChildBatchs(targetChilds); } + //FIXME tchemit-2014-08-29 We can only do this if not an a leaf node (means with no frequencies...) + //FIXME tchemit-2014-08-29 But need to see if this is really need to do that . + // see https://forge.codelutin.com/issues/5698 + + if (CollectionUtils.isNotEmpty(source.getChildBatchs()) && target.getWeight() != null) { + + SortingBatch childBatch = (SortingBatch) Iterables.get(source.getChildBatchs(), 0); + + boolean isFrequency = batchHelper.isFrequencyBatch(sampleCategoryModel, childBatch); + + if (!isFrequency) { + + // can't use this sample weight on a node + // the weight comes from sampleRatioText, but must NOT be used here + // but we can only do this if childs are not frequencies + + target.setWeight(null); + + } + + } + + QualityFlag qualityFlag = source.getQualityFlag(); target.setSpeciesToConfirm(qualityFlag != null && QualityFlagCode.DOUBTFUL.getValue().equals(qualityFlag.getCode())); -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
participants (1)
-
codelutin.com scm