mirror of
https://github.com/bellingcat/ukraine-timemap.git
synced 2026-06-12 21:38:35 +03:00
Allow categories to be selected by title and not id; allow for primary key field
This commit is contained in:
@@ -159,7 +159,7 @@ export function getEventCategories(event, categories) {
|
||||
const matchedCategories = [];
|
||||
if (event.associations && event.associations.length > 0) {
|
||||
event.associations.reduce((acc, val) => {
|
||||
const foundCategory = categories.find((cat) => cat.id === val);
|
||||
const foundCategory = categories.find((cat) => cat.title === val);
|
||||
if (foundCategory) acc.push(foundCategory);
|
||||
return acc;
|
||||
}, matchedCategories);
|
||||
|
||||
Reference in New Issue
Block a user