QML UI: fix bugs in change detection on dive edit

We were comparing apples to oranges on a few items and therefore more or less
always assumed that a dive had been modified.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2016-01-20 13:56:28 -08:00
parent a329d44de0
commit 60e0a6e833

View file

@ -433,7 +433,9 @@ QString QMLManager::commitChanges(QString diveId, QString date, QString location
if (same_string(d->dc.model, "manually added dive")) if (same_string(d->dc.model, "manually added dive"))
d->dc.maxdepth.mm = d->maxdepth.mm; d->dc.maxdepth.mm = d->maxdepth.mm;
} }
if (get_temperature_string(d->airtemp) != airtemp) { if (airtemp == "--")
airtemp = "";
if (get_temperature_string(d->airtemp, true) != airtemp) {
diveChanged = true; diveChanged = true;
if (airtemp.contains(tr("C"))) if (airtemp.contains(tr("C")))
prefs.units.temperature = units::CELSIUS; prefs.units.temperature = units::CELSIUS;
@ -441,7 +443,9 @@ QString QMLManager::commitChanges(QString diveId, QString date, QString location
prefs.units.temperature = units::FAHRENHEIT; prefs.units.temperature = units::FAHRENHEIT;
d->airtemp.mkelvin = parseTemperatureToMkelvin(airtemp); d->airtemp.mkelvin = parseTemperatureToMkelvin(airtemp);
} }
if (get_temperature_string(d->watertemp) != watertemp) { if (watertemp == "--")
watertemp = "";
if (get_temperature_string(d->watertemp, true) != watertemp) {
diveChanged = true; diveChanged = true;
if (watertemp.contains(tr("C"))) if (watertemp.contains(tr("C")))
prefs.units.temperature = units::CELSIUS; prefs.units.temperature = units::CELSIUS;