Allow categories to be selected by title and not id; allow for primary key field

This commit is contained in:
efarooqui
2021-04-30 17:47:16 -07:00
parent d6c5b55152
commit 123ed80d74
7 changed files with 17 additions and 16 deletions

View File

@@ -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);