clarify iso code impl

master
Edward Shen 2021-07-23 17:41:17 -04:00
parent 42cbd81375
commit 4544061845
Signed by: edward
GPG Key ID: F350507060ED6C90
1 changed files with 3 additions and 6 deletions

View File

@ -174,12 +174,9 @@ async fn fetch_db(license_key: ClientSecret) -> Result<(), DbLoadError> {
}
pub fn record_country_visit(country: Option<Country>) {
let iso_code = country.map_or("unknown", |country| {
country
.country
.and_then(|c| c.iso_code)
.unwrap_or("unknown")
});
let iso_code = country
.and_then(|country| country.country.and_then(|c| c.iso_code))
.unwrap_or("unknown");
COUNTRY_VISIT_COUNTER
.get_metric_with_label_values(&[iso_code])