Don't add separate country field, use taxonomy

The more I looked at the code that added the country to the dive site,
the more it seemed redundant given what we have with the taxonomy.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2017-10-02 23:03:44 -07:00
parent de10fd4021
commit 21d78121ad
8 changed files with 21 additions and 24 deletions

View file

@ -570,11 +570,14 @@ static inline struct dive_site *get_dive_site_for_dive(struct dive *dive)
return NULL;
}
static inline char *get_dive_country(struct dive *dive)
static inline const char *get_dive_country(struct dive *dive)
{
struct dive_site *ds = get_dive_site_by_uuid(dive->dive_site_uuid);
if (ds && ds->country)
return ds->country;
if (ds) {
int idx = taxonomy_index_for_category(&ds->taxonomy, TC_COUNTRY);
if (idx >= 0)
return ds->taxonomy.category[idx].value;
}
return NULL;
}