[PATCH 1/2] Fix air temperature for multi-dive editing

Linus Torvalds torvalds at linux-foundation.org
Sun Feb 3 02:17:35 PST 2013


From: Linus Torvalds <torvalds at linux-foundation.org>
Date: Sun, 3 Feb 2013 20:40:45 +1100
Subject: [PATCH 1/2] Fix air temperature for multi-dive editing

The air temperature editing was broken when you edited multiple dives at
once: even if you didn't actually change the air temperature, all dives
would be reset to that particular temperature.

The logic for editing dives is that we have a 'master' dive (which is
the dive that all the entries get filled in from), and only if the
entries have changed from what the master dive information was (ie the
user actually edited it) do we change that particular piece of
information.

And we only change it for dives that match the master dive for that
entry.

Signed-off-by: Linus Torvalds <torvalds at linux-foundation.org>
---
 info.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/info.c b/info.c
index b4c37a91fd23..c212316fe9af 100644
--- a/info.c
+++ b/info.c
@@ -579,7 +579,7 @@ static void save_dive_info_changes(struct dive *dive, struct dive *master, struc
 		default:
 			mkelvin = 0;
 		}
-		if (mkelvin != dive->dc.airtemp.mkelvin) {
+		if (mkelvin != dive->dc.airtemp.mkelvin && dive->dc.airtemp.mkelvin == master->dc.airtemp.mkelvin) {
 			dive->dc.airtemp.mkelvin = mkelvin;
 			changed = 1;
 		}
-- 
1.8.1.2.422.g08c0e7f



More information about the subsurface mailing list