Mark new dives "downloaded" when importing new dives

We used to do this just for dive computer downloads, but we should do it
for all imports, so that merging new import data always does the
expected thing: any new dive computers will be added to the end of the
list of preexisting dives, rather than the other way around.

(Of course, if you set the "prefer downloaded" flag, that reverses this
logic, and makes the newly imported dive computer data be the primary
dive computer.  That flag is currently only exported for dive computer
downloads, not for imports).

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Linus Torvalds 2014-05-14 15:30:07 +09:00 committed by Dirk Hohndel
parent 818542eeca
commit a8fbd3d283

View file

@ -912,6 +912,9 @@ void process_dives(bool is_imported, bool prefer_imported)
for (i = preexisting; i < dive_table.nr; i++) for (i = preexisting; i < dive_table.nr; i++)
set_dc_nickname(dive_table.dives[i]); set_dc_nickname(dive_table.dives[i]);
for (i = preexisting; i < dive_table.nr; i++)
dive_table.dives[i]->downloaded = true;
/* This does the right thing for -1: NULL */ /* This does the right thing for -1: NULL */
last = get_dive(preexisting - 1); last = get_dive(preexisting - 1);