Tony CHEMIT pushed to branch develop at ultreiaio / ird-t3 Commits: f3838753 by Tony CHEMIT at 2018-04-11T13:36:26Z Revert #239 (See #311) - - - - - 1 changed file: - t3-actions/src/main/java/fr/ird/t3/actions/data/level0/ComputeRF2Action.java Changes: ===================================== t3-actions/src/main/java/fr/ird/t3/actions/data/level0/ComputeRF2Action.java ===================================== --- a/t3-actions/src/main/java/fr/ird/t3/actions/data/level0/ComputeRF2Action.java +++ b/t3-actions/src/main/java/fr/ird/t3/actions/data/level0/ComputeRF2Action.java @@ -23,7 +23,6 @@ package fr.ird.t3.actions.data.level0; import com.google.common.collect.ArrayListMultimap; import com.google.common.collect.ListMultimap; import com.google.common.collect.Multimap; -import com.google.common.collect.TreeMultimap; import fr.ird.t3.entities.data.CompleteTrip; import fr.ird.t3.entities.data.RaisingFactor2; import fr.ird.t3.entities.data.RaisingFactor2TopiaDao; @@ -87,7 +86,6 @@ public class ComputeRF2Action extends AbstractLevel0Action<ComputeRF2Configurati private Multimap<Country, Species> speciesByCountry; /** usable complete trips group by vessel */ private ListMultimap<Vessel, CompleteTrip> completeTripsByVessel; - private Multimap<String, String> tripDone; public ComputeRF2Action() { super(Level0Step.COMPUTE_RF2); @@ -124,9 +122,7 @@ public class ComputeRF2Action extends AbstractLevel0Action<ComputeRF2Configurati fleets = countryDAO.findAll(); } // get all species usable for rf1 for all selected fleet countries - Multimap<Country, Species> result = rF1SpecieForFleetDAO.getSpeciesForCountry(fleets); - setSpeciesByCountry(result); - tripDone = TreeMultimap.create(); + this.speciesByCountry = rF1SpecieForFleetDAO.getSpeciesForCountry(fleets); List<Trip> tripList = getUsableTrips(landingHarbours, true); log.info("Trip count: " + tripList.size()); setTrips(tripList); @@ -309,14 +305,12 @@ public class ComputeRF2Action extends AbstractLevel0Action<ComputeRF2Configurati // set rf2 to all trips for (CompleteTrip trip : trips) { String tripStr = decorate(trip); - if (canLog(tripStr,"nbTrips")) { - if (rf2 != 1) { - nbTripsWithRF2++; - } - String message = l(locale, "t3.level0.computeRF1.resume.rf2.for.trip", tripStr, rf2); - log.info(message); - addInfoMessage(message); + if (rf2 != 1) { + nbTripsWithRF2++; } + String message = l(locale, "t3.level0.computeRF1.resume.rf2.for.trip", tripStr, rf2); + log.info(message); + addInfoMessage(message); trip.applyRf2(rf2); markTripAsTreated(trip); } @@ -338,14 +332,10 @@ public class ComputeRF2Action extends AbstractLevel0Action<ComputeRF2Configurati tripCatchWeight = trip.getElementaryCatchTotalWeightRf1(species); } totalCatchWeight += tripCatchWeight; - if (canLog(tripStr, "compute")) { - addInfoMessage(l(locale, "t3.level0.computeRF2.resume.rf1.for.trip", tripStr, tripCatchWeight, tripLandingWeight)); - } + addInfoMessage(l(locale, "t3.level0.computeRF2.resume.rf1.for.trip", tripStr, tripCatchWeight, tripLandingWeight)); } else { // this trip does not have any landing catches for given species - if (canLog(tripStr, "compute")) { - addWarningMessage(l(locale, "t3.level0.computeRF2.resume.skip.for.trip", tripStr)); - } + addWarningMessage(l(locale, "t3.level0.computeRF2.resume.skip.for.trip", tripStr)); } } addInfoMessage(l(locale, "t3.level0.computeRF2.resume.total.rf1", totalCatchWeight, totalLandingWeight)); @@ -363,19 +353,4 @@ public class ComputeRF2Action extends AbstractLevel0Action<ComputeRF2Configurati } } - private boolean canLog(String key, String method) { - boolean exist = tripDone.containsEntry(key, method); - if (!exist) { - tripDone.put(key, method); - } - return !exist; - } - - public Multimap<Country, Species> getSpeciesByCountry() { - return speciesByCountry; - } - - public void setSpeciesByCountry(Multimap<Country, Species> speciesByCountry) { - this.speciesByCountry = speciesByCountry; - } } View it on GitLab: https://gitlab.com/ultreiaio/ird-t3/commit/f3838753537370fa9cb355f70a5ad3247... --- View it on GitLab: https://gitlab.com/ultreiaio/ird-t3/commit/f3838753537370fa9cb355f70a5ad3247... You're receiving this email because of your account on gitlab.com.