We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent aad4f4c commit a15f154Copy full SHA for a15f154
wtp/locationSelector.js
@@ -62,7 +62,7 @@ class LocationSelector {
62
}
63
64
getBestLocationId(locations) {
65
- let selected = locations.reduce((acc, cur) => acc && this.getLocationScore(acc) < this.getLocationScore(cur) ? acc : cur);
+ let selected = locations.reduce((acc, cur) => acc && acc.score < cur.score ? acc : cur);
66
return selected.location;
67
68
@@ -82,6 +82,9 @@ class LocationSelector {
82
return
83
84
85
+ // enrich locations with our internal score
86
+ filtered.forEach((location) => { location.score = this.getLocationScore(location); });
87
+
88
this.location = this.getBestLocationId(filtered);
89
this.cachedAllLocations = filtered;
90
this.lastUpdated = Date.now();
0 commit comments