Tony CHEMIT pushed to branch develop at ultreiaio / ird-t3
Commits:
-
9d116e9a
by Tony CHEMIT at 2018-05-04T12:39:17Z
6 changed files:
- t3-actions/src/main/java/fr/ird/t3/actions/data/level2/L2CatchStratum.java
- t3-actions/src/main/java/fr/ird/t3/actions/data/level2/L2CatchStratumLoader.java
- t3-actions/src/main/java/fr/ird/t3/actions/data/level2/Level2Action.java
- t3-actions/src/main/java/fr/ird/t3/actions/data/level3/L3CatchStratumLoader.java
- t3-domain/src/main/java/fr/ird/t3/actions/stratum/CatchStratumLoader.java
- t3-domain/src/main/java/fr/ird/t3/entities/data/AbstractActivityTopiaDao.java
Changes:
| ... | ... | @@ -229,15 +229,4 @@ public class L2CatchStratum extends CatchStratum<Level2Configuration, Level2Acti |
| 229 | 229 |
return sampleWeightModelFroAllSpecies;
|
| 230 | 230 |
}
|
| 231 | 231 |
|
| 232 |
- public void resetCorrectedElementaryCatches() {
|
|
| 233 |
- for (Activity activity : getActivities().keySet()) {
|
|
| 234 |
- if (activity.isCorrectedElementaryCatchNotEmpty()) {
|
|
| 235 |
- for (CorrectedElementaryCatch correctedElementaryCatch : activity.getCorrectedElementaryCatch()) {
|
|
| 236 |
- if (correctedElementaryCatch.getCorrectedCatchWeight()==null) {
|
|
| 237 |
- correctedElementaryCatch.setCorrectedCatchWeight(correctedElementaryCatch.getCatchWeight());
|
|
| 238 |
- }
|
|
| 239 |
- }
|
|
| 240 |
- }
|
|
| 241 |
- }
|
|
| 242 |
- }
|
|
| 243 | 232 |
}
|
| ... | ... | @@ -23,6 +23,7 @@ package fr.ird.t3.actions.data.level2; |
| 23 | 23 |
import fr.ird.t3.actions.stratum.CatchStratumLoader;
|
| 24 | 24 |
import fr.ird.t3.entities.data.Activity;
|
| 25 | 25 |
import fr.ird.t3.entities.data.ActivityTopiaDao;
|
| 26 |
+import fr.ird.t3.entities.data.CorrectedElementaryCatch;
|
|
| 26 | 27 |
import fr.ird.t3.services.ioc.InjectDAO;
|
| 27 | 28 |
|
| 28 | 29 |
import java.util.Map;
|
| ... | ... | @@ -60,4 +61,13 @@ public class L2CatchStratumLoader extends CatchStratumLoader<Level2Configuration |
| 60 | 61 |
// - maree.bateau dans la bonne flotte OK
|
| 61 | 62 |
return filterActivities(configuration, activityIds);
|
| 62 | 63 |
}
|
| 64 |
+ |
|
| 65 |
+ @Override
|
|
| 66 |
+ protected void onActivityFound(Activity activity) {
|
|
| 67 |
+ if (activity.isCorrectedElementaryCatchNotEmpty()) {
|
|
| 68 |
+ for (CorrectedElementaryCatch correctedElementaryCatch : activity.getCorrectedElementaryCatch()) {
|
|
| 69 |
+ correctedElementaryCatch.setCorrectedCatchWeight(correctedElementaryCatch.getCatchWeight());
|
|
| 70 |
+ }
|
|
| 71 |
+ }
|
|
| 72 |
+ }
|
|
| 63 | 73 |
}
|
| \ No newline at end of file |
| ... | ... | @@ -174,8 +174,6 @@ public class Level2Action extends T3Action<Level2Configuration> { |
| 174 | 174 |
result.setSubstitutionLevel(0);
|
| 175 | 175 |
incrementsProgression();
|
| 176 | 176 |
} else {
|
| 177 |
- catchStratum.resetCorrectedElementaryCatches();
|
|
| 178 |
- //flushTransaction("clean stratum " + stratumConfiguration.getStratumIndex());
|
|
| 179 | 177 |
|
| 180 | 178 |
// compute sample stratum
|
| 181 | 179 |
try (L2SampleStratum sampleStratum = L2SampleStratum.newSampleStratum(stratumConfiguration, catchStratum, weightCategories, species, this)) {
|
| ... | ... | @@ -60,4 +60,9 @@ public class L3CatchStratumLoader extends CatchStratumLoader<Level3Configuration |
| 60 | 60 |
// - maree.bateau dans la bonne flotte OK
|
| 61 | 61 |
return filterActivities(configuration, activityIds);
|
| 62 | 62 |
}
|
| 63 |
+ |
|
| 64 |
+ @Override
|
|
| 65 |
+ protected void onActivityFound(Activity activity) {
|
|
| 66 |
+ |
|
| 67 |
+ }
|
|
| 63 | 68 |
}
|
| ... | ... | @@ -74,15 +74,19 @@ public abstract class CatchStratumLoader<C extends LevelConfigurationWithStratum |
| 74 | 74 |
String activityId = e.getKey();
|
| 75 | 75 |
// get activity
|
| 76 | 76 |
Activity activity = configuration.getActivity(activityId);
|
| 77 |
+ onActivityFound(activity);
|
|
| 77 | 78 |
// get his trip
|
| 78 | 79 |
Trip trip = activity.getTrip();
|
| 79 | 80 |
if (!possibleVessels.contains(trip.getVessel())) {
|
| 80 | 81 |
// not a matching boat
|
| 81 | 82 |
continue;
|
| 82 | 83 |
}
|
| 84 |
+// if (activity.isCorrectedElementaryCatchEmpty()) {
|
|
| 85 |
+// continue;
|
|
| 86 |
+// }
|
|
| 83 | 87 |
// recheck activity have some catches.
|
| 84 |
- Preconditions.checkState(!activity.isCorrectedElementaryCatchEmpty(),
|
|
| 85 |
- String.format("Can not accept an activity (%s) with no catch", activity.getTopiaId()));
|
|
| 88 |
+// Preconditions.checkState(!activity.isCorrectedElementaryCatchEmpty(),
|
|
| 89 |
+// String.format("Can not accept an activity (%s) with no catch", activity.getTopiaId()));
|
|
| 86 | 90 |
// weight category is in stratum, check there is catch using this category
|
| 87 | 91 |
if (weightCategoryTreatment != null && !activity.withCorrectedElementaryCatch(weightCategoryTreatment)) {
|
| 88 | 92 |
// reject - the stratum weight category not found for this activity
|
| ... | ... | @@ -93,4 +97,6 @@ public abstract class CatchStratumLoader<C extends LevelConfigurationWithStratum |
| 93 | 97 |
}
|
| 94 | 98 |
return result;
|
| 95 | 99 |
}
|
| 100 |
+ |
|
| 101 |
+ protected abstract void onActivityFound(Activity activity);
|
|
| 96 | 102 |
}
|
| ... | ... | @@ -151,8 +151,8 @@ public class AbstractActivityTopiaDao<E extends Activity> extends GeneratedActiv |
| 151 | 151 |
"AND a.expertflag != 0 " +
|
| 152 | 152 |
"AND a.schooltype IN (" + schoolTypeParameters.substring(2) + ")" +
|
| 153 | 153 |
"AND r.date::date >= ? " +
|
| 154 |
- "AND r.date::date <= ? " +
|
|
| 155 |
- "AND (SELECT COUNT(*) FROM CorrectedElementaryCatch c WHERE c.activity = a.topiaid) > 0"
|
|
| 154 |
+ "AND r.date::date <= ? "
|
|
| 155 |
+// + "AND (SELECT COUNT(*) FROM CorrectedElementaryCatch c WHERE c.activity = a.topiaid) > 0"
|
|
| 156 | 156 |
);
|
| 157 | 157 |
|
| 158 | 158 |
int index = 0;
|