OliverKeyes has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/273511

Change subject: Fix geodata retrieval code for Maps
......................................................................

Fix geodata retrieval code for Maps

Bug: T119448
Change-Id: Ie7db1059a096361513bd330cc64b417761155739
---
M maps/tiles.R
1 file changed, 3 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/discovery/golden 
refs/changes/11/273511/1

diff --git a/maps/tiles.R b/maps/tiles.R
index 0f1b0d5..dfcf11a 100644
--- a/maps/tiles.R
+++ b/maps/tiles.R
@@ -51,10 +51,11 @@
                                     by= setdiff(names(output),c("n","user_id", 
"is_automata"))]
   
   # Work out unique users on a per-country basis
+  top_countries <- c("RU", "IT", "US", "UA", "FR", "IN", "DE", "ES", "GB")
   unique_users <- output[, j = list(users = length(unique(user_id))), by = 
c("date","country")]
   unique_users <- unique_users[order(unique_users$users, decreasing = TRUE),]
-  user_output <- rbind(unique_users[1:9,],
-                       data.table(date = date, country = "Other", users = 
sum(unique_users$users[10:nrow(unique_users)])))
+  user_output <- rbind(unique_users[unique_users$country %in% top_countries,],
+                       data.table(date = date, country = "Other", users = 
sum(unique_users$users[!unique_users$country %in% top_countries])))
   user_output$users <- round(user_output$users/sum(user_output$users), 2)
   
   # Write out

-- 
To view, visit https://gerrit.wikimedia.org/r/273511
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie7db1059a096361513bd330cc64b417761155739
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/discovery/golden
Gerrit-Branch: master
Gerrit-Owner: OliverKeyes <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to