Map Divinglog's visibility to our stars

good (1) = 5
medium (2) = 3
bad (3) = 1

There seems also to be 0 used in the log, even though it is not
mentioned in the valid selections. This is not giving any stars for this
option...

Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
This commit is contained in:
Miika Turkia 2017-07-23 21:58:36 +03:00 committed by Dirk Hohndel
parent a7231be9a0
commit 685c59214d

View file

@ -3348,9 +3348,24 @@ extern int divinglog_dive(void *param, int columns, char **data, char **column)
if (data[11])
cur_dive->suit = strdup(data[11]);
/* TODO: check what the visibility options are in Divinglog and map them to Subsurface's 0-5 scale */
if (data[14])
cur_dive->visibility = atoi(data[14]);
/* Divinglog has following visibility options: good, medium, bad */
if (data[14]) {
switch(data[14][0]) {
case '0':
break;
case '1':
cur_dive->visibility = 5;
break;
case '2':
cur_dive->visibility = 3;
break;
case '3':
cur_dive->visibility = 1;
break;
default:
break;
}
}
settings_start();
dc_settings_start();