-
Notifications
You must be signed in to change notification settings - Fork 1
/
leaderboard_lesotho_NOV.html
160 lines (136 loc) · 14.1 KB
/
leaderboard_lesotho_NOV.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
<!DOCTYPE html>
<html>
<meta charset='utf-8' />
<head>
<style>
html, body {
background-color: #474a4e;
}
#indiv {
color: #000;
}
#teams {
color: #000;
}
#header {
font-weight: bold;
background-color: #32c987;
color: white;
}
tr:nth-child(even) {
background-color: #f2f2f2
}
tr:nth-child(odd) {
background-color: #d3d3d3;
}
tr {
width: 200px;
}
td {
height: 10px;
width: 180px;
}
table {
float:right;
}
div {
background-color: #474a4e;
}
</style>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script>
$(document).ready( function() {
var userjson = "https://raw.githubusercontent.com/eneerhut/mapillary_leaderboard/blob/master/usernames.json";
console.log(userjson);
var array = [];
var array2 = [];
var iscores = [];
$.ajax({
type: "get",
dataType: "json",
url: userjson,
async: false,
success: function(data) {
for (var u = 0; u < data.usernames.length; u++) {
var user = data.usernames[u]["user"];
var team = data.usernames[u]["team"];
console.log(user, team);
var url = "https://a.mapillary.com/v2/search/im?client_id=UTZhSnNFdGpxSEFFREUwb01GYzlXZzpkMWM2YzdjYjQxN2FhM2Vh&max_lat=-28.57004987964739&max_lon=29.443359375&min_lat=-30.699335004371967&min_lon=27.0648193359375&limit=10000000&user=" + user + "&start_time=" + 1479081600 + "&end_time=" + 1483142400
var len;
$.ajax({
type: "get",
dataType: "json",
url: url,
async: false,
success: function(data) {
console.log(user, data.ims.length);
len = data.ims.length;
return len;
}
});
iscores.push({user, len, team});
array2.push({team, len});
}
}
});
teams = array.filter(function(item, i, ar){ return ar.indexOf(item) === i; });
let objArr = array2
let counts = objArr.reduce((prev, curr) => {
let count = prev.get(curr.team) || 0;
prev.set(curr.team, curr.len + count);
return prev;
}, new Map());
let scores = [...counts].map(([team, len]) => {
return {team, len}
})
console.log(JSON.stringify(scores));
scores.sort(function(a,b){
return b.len - a.len;
}
);
iscores.sort(function(a,b){
return b.len - a.len;
}
);
for (x = 0; x < scores.length; x++) {
$('#teams').append('<tr><td>' + (x+1) + '</td><td>' + scores[x].team + '</td><td>' + scores[x].len + '</td></tr>');
};
for (x = 0; x < iscores.length; x++) {
$('#indiv').append('<tr><td>' + (x+1) + '</td><td>' + iscores[x].user + '</td><td>' + iscores[x].len + '</td><td>' + iscores[x].team + '</td></tr>');
};
});
</script>
</head>
<body bgcolor=#474a4e>
<div class="container-fluid" id="topstuff" style:"background-color:#474a4e">
<div class="row">
<div class="col-sm-12"><br>
<img width=20% height=20% style="float:left" align=left src=data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D%22100%25%22%20height%3D%22100%25%22%20viewBox%3D%220%200%20124%2031%22%20version%3D%221.1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22%3E%0A%20%20%20%20%3C!--%20Generator%3A%20Sketch%203.7.2%20(28276)%20-%20http%3A%2F%2Fwww.bohemiancoding.com%2Fsketch%20--%3E%0A%20%20%20%20%3Ctitle%3Emapillary_logo_white%3C%2Ftitle%3E%0A%20%20%20%20%3Cdesc%3ECreated%20with%20Sketch.%3C%2Fdesc%3E%0A%20%20%20%20%3Cdefs%2F%3E%0A%20%20%20%20%3Cg%20id%3D%22Symbols%22%20stroke%3D%22none%22%20stroke-width%3D%221%22%20fill%3D%22none%22%20fill-rule%3D%22evenodd%22%3E%0A%20%20%20%20%20%20%20%20%3Cg%20id%3D%22%E2%84%B0%F0%9D%93%81%F0%9D%93%8B%F0%9D%92%B6-icons%22%20transform%3D%22translate(-75.000000%2C%20-98.000000)%22%2F%3E%0A%20%20%20%20%20%20%20%20%3Cg%20id%3D%22mapillary_logo_white%22%20fill%3D%22%23FFFFFF%22%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%3Cpath%20d%3D%22M14.4048145%2C22.8600538%20C14.9457128%2C23.1497241%2028.061419%2C30.4264248%2028.4753898%2C30.6604505%20C29.3027163%2C31.1281541%2030.1782211%2C30.223259%2029.7280238%2C29.3772816%20C29.5012572%2C28.9511587%2022.3973062%2C15.2256852%2022.1573833%2C14.8052961%20C21.9174603%2C14.3849069%2021.327308%2C14.1728729%2020.8839051%2C14.4549775%20C20.4495505%2C14.7313254%2019.9489516%2C15.0425066%2019.6691323%2C15.1915819%20C19.1036645%2C15.4928378%2019.0343163%2C15.9455546%2019.287992%2C16.448894%20C19.8455279%2C17.5551486%2021.6002813%2C20.9114602%2021.8011436%2C21.2631855%20C22.2217412%2C21.9996844%2021.2840763%2C22.8403329%2020.6482558%2C22.4731735%20C20.3789751%2C22.3176753%2016.2151224%2C20.0214804%2015.9209064%2C19.8416031%20C15.6266904%2C19.6617258%2015.105463%2C19.6635491%2014.7478512%2C20.2701674%20C14.4878069%2C20.7112814%2014.1687296%2C21.2586089%2014.021539%2C21.5330151%20C13.7321257%2C22.072566%2013.8639161%2C22.5703835%2014.4048145%2C22.8600538%20L14.4048145%2C22.8600538%20Z%22%20id%3D%22Path-24%22%2F%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%3Cpath%20d%3D%22M0.558264236%2C15.1845845%20C-0.139955714%2C14.7876168%20-0.0122511587%2C13.7561718%200.86881516%2C13.4931024%20C1.61530137%2C13.2702161%207.67723351%2C11.1397077%209.51169898%2C10.4940511%20C9.84242521%2C10.377649%2010.1006199%2C10.1099619%2010.2117245%2C9.76820464%20C10.8365399%2C7.84627551%2012.9234851%2C1.42684187%2013.1574424%2C0.707189464%20C13.4330019%2C-0.140431476%2014.4305705%2C-0.143540941%2014.8371503%2C0.677033754%20C14.981563%2C0.968493025%2020.4705227%2C11.399215%2020.6614961%2C11.8416826%20C20.8524695%2C12.2841502%2020.7294316%2C12.7742661%2020.2966045%2C13.0569644%20C19.8637775%2C13.3396627%2019.1579297%2C13.762502%2018.9120084%2C13.9226924%20C18.4667877%2C14.2127044%2018.0400535%2C14.0107915%2017.8368009%2C13.5615688%20C17.6335482%2C13.1123462%2016.0676727%2C10.2138539%2015.4291532%2C8.98332303%20C15.1099927%2C8.36824868%2014.1484882%2C8.13221067%2013.8253048%2C9.12632135%20C13.5915518%2C9.84534444%2013.0467253%2C11.5212285%2012.7630985%2C12.3936632%20C12.6545871%2C12.7274438%2012.3795458%2C13.0147345%2012.0582391%2C13.1263214%20C11.2608649%2C13.4032424%209.74573408%2C13.9294338%208.86113118%2C14.2366485%20C8.22986879%2C14.4558803%207.92302987%2C15.469644%208.77532438%2C15.8965445%20C8.95335681%2C15.9857181%2012.7907091%2C18.1445988%2013.1866332%2C18.342058%20C13.5825573%2C18.5395172%2013.8027154%2C19.1095208%2013.5708725%2C19.5133371%20C13.2546404%2C20.0641395%2012.8497933%2C20.7631874%2012.7029326%2C20.9901372%20C12.4484022%2C21.3834734%2011.9484091%2C21.5144676%2011.5284902%2C21.282311%20C11.1085712%2C21.0501544%200.807750977%2C15.3264283%200.558264236%2C15.1845845%20Z%22%20id%3D%22Path-2%22%2F%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%3Cpath%20d%3D%22M51.9322475%2C7.92400589%20L51.9322475%2C24.7365831%20L48.7644221%2C24.7365831%20L48.7644221%2C15.9901556%20L45.2006185%2C24.7365831%20L43.4769487%2C24.7365831%20L39.9131451%2C15.9901556%20L39.9131451%2C24.7365831%20L36.7453197%2C24.7365831%20L36.7453197%2C7.92400589%20L40.0063165%2C7.92400589%20L44.3387836%2C18.5169013%20L48.6712507%2C7.92400589%20L51.9322475%2C7.92400589%20L51.9322475%2C7.92400589%20Z%20M65.7569067%2C11.5926463%20L68.528754%2C11.5926463%20L68.528754%2C12.6859497%20C68.7150976%2C12.2972177%2069.0877792%2C11.9651807%2069.64681%2C11.6898288%20C70.2058408%2C11.4144769%2070.8192127%2C11.2768031%2071.4869439%2C11.2768031%20C72.1236179%2C11.2768031%2072.7214613%2C11.4266246%2073.2804921%2C11.7262723%20C73.839523%2C12.0259199%2074.3247855%2C12.4672861%2074.7362943%2C13.0503842%20C75.1478031%2C13.6334823%2075.4738995%2C14.3542455%2075.7145933%2C15.2126954%20C75.9552871%2C16.0711454%2076.0756322%2C17.0510594%2076.0756322%2C18.1524669%20C76.0756322%2C19.2862687%2075.9591692%2C20.2823796%2075.7262397%2C21.1408296%20C75.4933102%2C21.9992795%2075.174978%2C22.7200427%2074.7712335%2C23.3031408%20C74.3674891%2C23.8862389%2073.8899907%2C24.3235559%2073.3387242%2C24.6151049%20C72.7874577%2C24.906654%2072.1857322%2C25.0524263%2071.5335296%2C25.0524263%20C70.8347411%2C25.0524263%2070.2718365%2C24.9390478%2069.8447991%2C24.7122874%20C69.4177617%2C24.4855271%2069.1110758%2C24.2020809%2068.9247322%2C23.8619403%20L68.9247322%2C29.1016489%20L65.7569067%2C29.8102962%20L65.7569067%2C11.5926463%20L65.7569067%2C11.5926463%20Z%20M70.7415732%2C21.9182898%20C72.278908%2C21.9182898%2073.0475638%2C20.6711265%2073.0475638%2C18.1767625%20C73.0475638%2C16.9619748%2072.8573409%2C16.0387501%2072.4768894%2C15.4070605%20C72.0964378%2C14.7753709%2071.5490617%2C14.4595308%2070.8347446%2C14.4595308%20C70.306771%2C14.4595308%2069.8680937%2C14.6498447%2069.5186994%2C15.0304782%20C69.1693052%2C15.4111117%2068.9014403%2C15.8605763%2068.7150967%2C16.3788858%20L68.7150967%2C20.120413%20C68.9324975%2C20.7197083%2069.2236551%2C21.169173%2069.5885779%2C21.4688206%20C69.9535008%2C21.7684682%2070.3378288%2C21.9182898%2070.7415732%2C21.9182898%20L70.7415732%2C21.9182898%20L70.7415732%2C21.9182898%20Z%20M80.6410277%2C11.5926463%20L80.6410277%2C24.7365831%20L77.4499094%2C24.7365831%20L77.4499094%2C11.5926463%20L80.6410277%2C11.5926463%20L80.6410277%2C11.5926463%20Z%20M77.4499094%2C8.67717048%20C77.4499094%2C8.20745258%2077.5974293%2C7.80252943%2077.8924733%2C7.46238889%20C78.1875173%2C7.12224834%2078.5679632%2C6.95218062%2079.0338222%2C6.95218062%20C79.4686239%2C6.95218062%2079.8451876%2C7.12224834%2080.1635246%2C7.46238889%20C80.4818616%2C7.80252943%2080.6410277%2C8.20745258%2080.6410277%2C8.67717048%20C80.6410277%2C9.13069121%2080.4818616%2C9.51536819%2080.1635246%2C9.83121299%20C79.8451876%2C10.1470578%2079.4686239%2C10.3049778%2079.0338222%2C10.3049778%20C78.5679632%2C10.3049778%2078.1875173%2C10.1470578%2077.8924733%2C9.83121299%20C77.5974293%2C9.51536819%2077.4499094%2C9.13069121%2077.4499094%2C8.67717048%20L77.4499094%2C8.67717048%20L77.4499094%2C8.67717048%20Z%20M82.2948189%2C8.14266658%20L85.4626444%2C7.02506752%20L85.4626444%2C24.7365831%20L82.2948189%2C24.7365831%20L82.2948189%2C8.14266658%20L82.2948189%2C8.14266658%20Z%20M87.1164356%2C8.14266658%20L90.284261%2C7.02506752%20L90.284261%2C24.7365831%20L87.1164356%2C24.7365831%20L87.1164356%2C8.14266658%20L87.1164356%2C8.14266658%20Z%20M107.473755%2C11.5926463%20L107.473755%2C12.4915847%20C107.691156%2C12.1190498%20108.048309%2C11.8234559%20108.545225%2C11.6047941%20C109.042142%2C11.3861323%20109.562343%2C11.2768031%20110.105845%2C11.2768031%20C110.463004%2C11.2768031%20110.808511%2C11.3334923%20111.142376%2C11.4468725%20C111.476242%2C11.5602527%20111.736343%2C11.7465173%20111.922686%2C12.005672%20L110.781337%2C14.9454435%20C110.393122%2C14.5891058%20109.966091%2C14.4109396%20109.500232%2C14.4109396%20C109.112016%2C14.4109396%20108.758745%2C14.5607611%20108.440408%2C14.8604088%20C108.122071%2C15.1600564%20107.86197%2C15.625718%20107.660098%2C16.2574076%20L107.660098%2C24.7365831%20L104.492272%2C24.7365831%20L104.492272%2C11.5926463%20L107.473755%2C11.5926463%20L107.473755%2C11.5926463%20Z%20M99.658896%2C23.7781238%20C98.8148003%2C24.5427672%2097.8313738%2C25.0733716%2096.7817699%2C25.0733716%20C93.1465504%2C25.0733716%2091.6227897%2C21.9953219%2091.6227897%2C18.1983552%20C91.6227897%2C14.4013884%2093.1465504%2C11.3233387%2096.7817699%2C11.3233387%20C97.9116638%2C11.3233387%2098.8719458%2C11.8179799%2099.658896%2C12.5606768%20L99.658896%2C11.5015381%20L102.887072%2C11.5015381%20L102.887072%2C24.8951722%20L99.658896%2C24.8951722%20L99.658896%2C23.7781238%20L99.658896%2C23.7781238%20Z%20M99.658896%2C20.4586659%20C99.254685%2C21.3716138%2098.5400909%2C21.9417675%2097.5072848%2C21.9604005%20C95.5542163%2C21.9956361%2094.8049284%2C20.3189429%2094.7697277%2C18.2345973%20C94.734527%2C16.1502516%2095.4267432%2C14.4475525%2097.3798117%2C14.4123171%20C98.3866813%2C14.3941522%2099.2030503%2C15.0592288%2099.658896%2C16.1291917%20L99.658896%2C20.4586659%20L99.658896%2C20.4586659%20Z%20M61.2789655%2C23.7781238%20C60.4348699%2C24.5427672%2059.4514434%2C25.0733716%2058.4018395%2C25.0733716%20C54.76662%2C25.0733716%2053.2428592%2C21.9953219%2053.2428592%2C18.1983552%20C53.2428592%2C14.4013884%2054.76662%2C11.3233387%2058.4018395%2C11.3233387%20C59.5317334%2C11.3233387%2060.4920154%2C11.8179799%2061.2789655%2C12.5606768%20L61.2789655%2C11.5015381%20L64.5071419%2C11.5015381%20L64.5071419%2C24.8951722%20L61.2789655%2C24.8951722%20L61.2789655%2C23.7781238%20L61.2789655%2C23.7781238%20L61.2789655%2C23.7781238%20Z%20M61.2789655%2C20.4586659%20C60.8747545%2C21.3716138%2060.1601605%2C21.9417675%2059.1273544%2C21.9604005%20C57.1742859%2C21.9956361%2056.424998%2C20.3189429%2056.3897972%2C18.2345973%20C56.3545965%2C16.1502516%2057.0468128%2C14.4475525%2058.9998813%2C14.4123171%20C60.0067509%2C14.3941522%2060.8231199%2C15.0592288%2061.2789655%2C16.1291917%20L61.2789655%2C20.4586659%20L61.2789655%2C20.4586659%20L61.2789655%2C20.4586659%20Z%20M117.768879%2C29.4013444%20L114.461296%2C29.4013444%20L116.441187%2C23.5946884%20L112.295063%2C11.5926463%20L115.788988%2C11.5926463%20L118.141564%2C19.2214747%20L120.49414%2C11.5926463%20L123.918187%2C11.5926463%20L117.768879%2C29.4013444%20L117.768879%2C29.4013444%20Z%22%20id%3D%22Mapillary%22%2F%3E%0A%20%20%20%20%20%20%20%20%3C%2Fg%3E%0A%20%20%20%20%3C%2Fg%3E%0A%3C%2Fsvg%3E>
</div>
</div>
<div class="row">
<div class="col-sm-12">
<br><div class="well well-sm" id="header"><h4 style="color:white;font-family:Century;text-align:center">#MapLesotho Challenge Leaderboard - November 14th - December 31st</h4></div>
</div>
</div>
<div class="row">
<div class="col-sm-6">
<table id="indiv" class="table">
<tr id="header"><td>rank</td><td>username</td><td>photos</td><td>team</td></tr>
</table>
</div>
<div class="col-sm-1">
</div>
<div class="col-sm-4">
<table id="teams" class="table">
<tr id="header"><td>rank</td><td>team</td><td>total photos</td></tr>
</table>
</div>
<div class="col-sm-1">
</div>
</div>
</div>
</body>
</html>