Edit: use correct offset when changing dive times

The undo-work reversed the direction of the offset. This was apparently
only fixed when using the menu entry, but not when editing dives directly.
Invert the offset to get the correct time.

While doing so, remove a redundant if: First it checked whether the
dates are the same, then whether the offset is non-zero.

Fixes #1975.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2019-02-18 18:40:28 +01:00 committed by Dirk Hohndel
parent 9d582c5512
commit 68b5493c14

View file

@ -892,11 +892,9 @@ void MainTab::acceptChanges()
}
}
if (displayed_dive.when != cd->when) {
timestamp_t offset = cd->when - displayed_dive.when;
if (offset)
Command::shiftTime(selectedDives, (int)offset);
}
timestamp_t offset = displayed_dive.when - cd->when;
if (offset)
Command::shiftTime(selectedDives, (int)offset);
}
if (editMode == MANUALLY_ADDED_DIVE) {
// we just added or edited the dive, let fixup_dive() make