Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe
Commits:
-
4eb7744b
by Tony Chemit at 2023-05-11T13:18:54+02:00
-
98b5886d
by Tony Chemit at 2023-05-11T13:19:22+02:00
3 changed files:
- client/datasource/editor/ll/src/main/java/fr/ird/observe/client/datasource/editor/ll/data/logbook/SetUI.jcss
- client/datasource/editor/ll/src/main/java/fr/ird/observe/client/datasource/editor/ll/data/logbook/SetUIModelStates.java
- core/persistence/consolidation/src/main/java/fr/ird/observe/consolidation/data/ps/observation/CatchConsolidateActions.java
Changes:
| ... | ... | @@ -30,14 +30,14 @@ DateTimeEditor { |
| 30 | 30 | }
|
| 31 | 31 | |
| 32 | 32 | #copyFirstValuesAndSave {
|
| 33 | - enabled:{states.isUpdatingMode() && states.getCopyFirstSetCandidate() != null && states.isValid()};
|
|
| 33 | + enabled:{!states.isReadingMode() && states.getCopyFirstSetCandidate() != null && states.isValid()};
|
|
| 34 | 34 | text:"observe.data.ll.logbook.Set.action.copyFirstValuesAndSave";
|
| 35 | 35 | toolTipText:"observe.data.ll.logbook.Set.action.copyFirstValuesAndSave";
|
| 36 | 36 | _keyStroke:{fr.ird.observe.client.datasource.editor.ll.ObserveLLKeyStrokes.KEY_STROKE_COPY_FIRST_VALUES_AND_SAVE};
|
| 37 | 37 | }
|
| 38 | 38 | |
| 39 | 39 | #copyLastValuesAndSave {
|
| 40 | - enabled:{states.isUpdatingMode() && states.getCopyLastSetCandidate() != null && states.isValid()};
|
|
| 40 | + enabled:{!states.isReadingMode() && states.getCopyLastSetCandidate() != null && states.isValid()};
|
|
| 41 | 41 | text:"observe.data.ll.logbook.Set.action.copyLastValuesAndSave";
|
| 42 | 42 | toolTipText:"observe.data.ll.logbook.Set.action.copyLastValuesAndSave";
|
| 43 | 43 | _keyStroke:{fr.ird.observe.client.datasource.editor.ll.ObserveLLKeyStrokes.KEY_STROKE_COPY_LAST_VALUES_AND_SAVE};
|
| ... | ... | @@ -51,7 +51,7 @@ public class SetUIModelStates extends GeneratedSetUIModelStates { |
| 51 | 51 | copySetCandidates = form.getObject().getOtherSets().stream()
|
| 52 | 52 | .sorted(Comparator.comparing(SetStubDto::getSettingStartTimeStamp))
|
| 53 | 53 | .collect(Collectors.toList());
|
| 54 | - updateCopySetCandidate(getBean().getSettingStartTimeStamp());
|
|
| 54 | + updateCopySetCandidate(null);
|
|
| 55 | 55 | super.copyFormToBean(form);
|
| 56 | 56 | }
|
| 57 | 57 | |
| ... | ... | @@ -91,17 +91,19 @@ public class SetUIModelStates extends GeneratedSetUIModelStates { |
| 91 | 91 | }
|
| 92 | 92 | |
| 93 | 93 | private void updateCopySetCandidate(Date newValue) {
|
| 94 | + if (isReadingMode()) {
|
|
| 95 | + return;
|
|
| 96 | + }
|
|
| 97 | + setCopyFirstSetCandidate(null);
|
|
| 98 | + setCopyLastSetCandidate(null);
|
|
| 94 | 99 | if (newValue == null) {
|
| 95 | - setCopyLastSetCandidate(null);
|
|
| 96 | - } else {
|
|
| 97 | - List<SetStubDto> collect = copySetCandidates.stream().filter(e -> e.getSettingStartTimeStamp().before(newValue)).collect(Collectors.toList());
|
|
| 98 | - if (collect.isEmpty()) {
|
|
| 99 | - setCopyFirstSetCandidate(null);
|
|
| 100 | - setCopyLastSetCandidate(null);
|
|
| 101 | - } else {
|
|
| 102 | - setCopyFirstSetCandidate(collect.get(0));
|
|
| 103 | - setCopyLastSetCandidate(collect.get(collect.size() - 1));
|
|
| 104 | - }
|
|
| 100 | + return;
|
|
| 101 | + }
|
|
| 102 | + List<SetStubDto> collect = copySetCandidates.stream().filter(e -> e.getSettingStartTimeStamp().before(newValue)).collect(Collectors.toList());
|
|
| 103 | + if (collect.isEmpty()) {
|
|
| 104 | + return;
|
|
| 105 | 105 | }
|
| 106 | + setCopyFirstSetCandidate(collect.get(0));
|
|
| 107 | + setCopyLastSetCandidate(collect.get(collect.size() - 1));
|
|
| 106 | 108 | }
|
| 107 | 109 | } |
| ... | ... | @@ -143,7 +143,7 @@ public enum CatchConsolidateActions implements AtomicConsolidateAction<CatchCons |
| 143 | 143 | public void accept(CatchConsolidateContext context, Catch aCatch) {
|
| 144 | 144 | float meanWeight = aCatch.getMeanWeight();
|
| 145 | 145 | float catchWeight = aCatch.getCatchWeight();
|
| 146 | - int totalCount = (int) ((float) 1000 * catchWeight / meanWeight);
|
|
| 146 | + int totalCount = Math.round(1000f * catchWeight / meanWeight);
|
|
| 147 | 147 | aCatch.setTotalCount(totalCount);
|
| 148 | 148 | aCatch.setTotalCountComputedSource(CatchComputedValueSource.fromData);
|
| 149 | 149 | }
|