From 1d4892fd4786589fa1b6abb9016b460d248c0f6c Mon Sep 17 00:00:00 2001 From: Lachlan Kermode Date: Wed, 17 Jun 2020 17:11:01 +0200 Subject: [PATCH] selection corner case --- src/components/Layout.js | 10 ++++++---- src/reducers/validate/eventSchema.js | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/components/Layout.js b/src/components/Layout.js index f9af24b..4c7669e 100644 --- a/src/components/Layout.js +++ b/src/components/Layout.js @@ -73,10 +73,12 @@ class Dashboard extends React.Component { ptr -= 1 } // check events after - ptr = idx + 1 - while (events[idx].datetime === events[ptr].datetime) { - matchedEvents.push(events[ptr]) - ptr += 1 + if (idx < events.length - 1) { + ptr = idx + 1 + while (events[idx].datetime === events[ptr].datetime) { + matchedEvents.push(events[ptr]) + ptr += 1 + } } } else { // Map... const std = { ...selected } diff --git a/src/reducers/validate/eventSchema.js b/src/reducers/validate/eventSchema.js index b0532ef..38e0afc 100644 --- a/src/reducers/validate/eventSchema.js +++ b/src/reducers/validate/eventSchema.js @@ -10,7 +10,7 @@ const eventSchema = Joi.object().keys({ latitude: Joi.string().allow(''), longitude: Joi.string().allow(''), type: Joi.string().allow(''), - category: Joi.string().required(), + category: Joi.string().allow(''), category_full: Joi.string().allow(''), narratives: Joi.array(), sources: Joi.array(),