clarify iso code impl
This commit is contained in:
parent
42cbd81375
commit
4544061845
1 changed files with 3 additions and 6 deletions
|
@ -174,12 +174,9 @@ async fn fetch_db(license_key: ClientSecret) -> Result<(), DbLoadError> {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn record_country_visit(country: Option<Country>) {
|
pub fn record_country_visit(country: Option<Country>) {
|
||||||
let iso_code = country.map_or("unknown", |country| {
|
let iso_code = country
|
||||||
country
|
.and_then(|country| country.country.and_then(|c| c.iso_code))
|
||||||
.country
|
.unwrap_or("unknown");
|
||||||
.and_then(|c| c.iso_code)
|
|
||||||
.unwrap_or("unknown")
|
|
||||||
});
|
|
||||||
|
|
||||||
COUNTRY_VISIT_COUNTER
|
COUNTRY_VISIT_COUNTER
|
||||||
.get_metric_with_label_values(&[iso_code])
|
.get_metric_with_label_values(&[iso_code])
|
||||||
|
|
Loading…
Reference in a new issue