mirror of
https://github.com/heyarne/berliner-winter.git
synced 2026-05-06 19:23:39 +02:00
fixed noncategorized filter
This commit is contained in:
parent
07f80c0a3f
commit
b94a7ff409
2 changed files with 10 additions and 5 deletions
|
|
@ -41,7 +41,7 @@ def articles():
|
||||||
"date": article[1],
|
"date": article[1],
|
||||||
"place": article[2],
|
"place": article[2],
|
||||||
"description": article[3],
|
"description": article[3],
|
||||||
"categories": [article[4]],
|
"categories": [article[4]] if article[4] else [],
|
||||||
"lat": locations[article_id][0],
|
"lat": locations[article_id][0],
|
||||||
"lng": locations[article_id][1],
|
"lng": locations[article_id][1],
|
||||||
"place": locations[article_id][2]
|
"place": locations[article_id][2]
|
||||||
|
|
|
||||||
|
|
@ -8,11 +8,16 @@ export default {
|
||||||
*/
|
*/
|
||||||
byCategories: function (data, categories) {
|
byCategories: function (data, categories) {
|
||||||
return data.filter(function (incident) {
|
return data.filter(function (incident) {
|
||||||
|
if(incident.categories.length > 0) {
|
||||||
for (var i = 0, l = incident.categories.length; i < l; i++)
|
for (var i = 0, l = incident.categories.length; i < l; i++)
|
||||||
if (categories.indexOf(incident.categories[i]) !== -1)
|
if (categories.indexOf(incident.categories[i]) !== -1)
|
||||||
return true
|
return true
|
||||||
|
} else {
|
||||||
|
if(categories.indexOf("uncategorized") !== -1)
|
||||||
|
return true
|
||||||
|
else
|
||||||
return false
|
return false
|
||||||
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue