mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 16:22:20 +00:00
fix(news): list Local newest first
Local ranked its reports by severity first. A country's own news now carries no severity, so in a conflict area GDELT's reports (severity 1 and up) could crowd every one of its stories out of the 40 listed. Local is now newest first; severity still shows by colour. Also: readTitle reads Conflicts headlines only, the economy category's comment and the attribution popover name World News API's category, and KNOWN-ISSUES names Core's ids for World News API's categories.
This commit is contained in:
1 parent
82057cbb51
commit
427463cc45
7 files changed
+21
-19
No files matched your search
@@ -762,9 +762,10 @@ export function inPolygons(polygons, point) {
|
||||
}
|
||||
|
||||
/**
|
||||
* The reports near `centre` that pass the filters, most severe and newest
|
||||
* first: any pin inside `area` (outline polygons), or without one within
|
||||
* NEWS_IN_VIEW_RADIUS_KM.
|
||||
* The reports near `centre` that pass the filters, newest first: any pin
|
||||
* inside `area` (outline polygons), or without one within
|
||||
* NEWS_IN_VIEW_RADIUS_KM. Newest, not most severe: an area's own news often
|
||||
* carries no severity, and the area's fighting would otherwise crowd it out.
|
||||
*/
|
||||
export function reportsInView(
|
||||
reports,
|
||||
@@ -786,10 +787,6 @@ export function reportsInView(
|
||||
(filters.category === 'all' || r.category === filters.category) &&
|
||||
r.pins?.some(near),
|
||||
)
|
||||
.sort(
|
||||
(a, b) =>
|
||||
reportSeverity(b) - reportSeverity(a) ||
|
||||
b.publishedAt.localeCompare(a.publishedAt),
|
||||
)
|
||||
.sort((a, b) => b.publishedAt.localeCompare(a.publishedAt))
|
||||
.slice(0, limit);
|
||||
}
|
||||
@@ -672,7 +672,7 @@ test('in view: half-degree cells and reports within 500 km of the centre', () =>
|
||||
reportsInView([near, far, old, major], centre, filters, NOW).map(
|
||||
(r) => r.id,
|
||||
),
|
||||
['major', 'near'],
|
||||
['near', 'major'],
|
||||
);
|
||||
assert.deepEqual(reportsInView([near], null, filters, NOW), []);
|
||||
assert.deepEqual(reportsInView([], centre, filters, NOW), []);
|
||||
|
||||
Reference in new issue
Block a user