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:
Denis Groshev committed 2026-11-06 00:45:33 +01:00
1 parent 82057cbb51
commit 427463cc45
7 files changed
+21 -19

No files matched your search

+1 -1
View File
@@ -498,7 +498,7 @@ export const DATA_CREDITS = [
'News: every report is credited to its own publisher and links to the original article; ' +
'pictures are the publishers’ own, shown from their sites with the publisher named. ' +
'Places, categories, severity and English headlines are derived automatically, by ' +
'bundled rules or by the configured news server, and can be wrong.',
'bundled rules, the news provider or the configured news server, and can be wrong.',
},
{
// GDELT's terms ask for a citation and a link.
+5 -8
View File
@@ -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);
}
+1 -1
View File
@@ -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), []);