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 736941870a
commit a3a1a74d1f

View file

@ -903,11 +903,9 @@ void MainTab::acceptChanges()
} }
} }
if (displayed_dive.when != cd->when) { timestamp_t offset = displayed_dive.when - cd->when;
timestamp_t offset = cd->when - displayed_dive.when; if (offset)
if (offset) Command::shiftTime(selectedDives, (int)offset);
Command::shiftTime(selectedDives, (int)offset);
}
} }
if (editMode != TRIP && current_dive->divetrip) { if (editMode != TRIP && current_dive->divetrip) {
current_dive->divetrip->when = current_dive->when; current_dive->divetrip->when = current_dive->when;