Modifying lat long to have decimals and not commas; adding extra title field to associations

This commit is contained in:
efarooqui
2021-04-28 18:10:41 -07:00
parent 62274fdb23
commit b09f85748b
2 changed files with 5 additions and 0 deletions

View File

@@ -2,6 +2,7 @@ import Joi from "joi";
const associationsSchema = Joi.object().keys({
id: Joi.string().allow("").required(),
title: Joi.string().allow("").required(),
desc: Joi.string().allow(""),
mode: Joi.string().allow("").required(),
filter_paths: Joi.array(),

View File

@@ -137,6 +137,10 @@ export function validateDomain(domain, features) {
// append events with datetime and sort
sanitizedDomain.events = sanitizedDomain.events.filter((event, idx) => {
event.id = idx;
// if lat, long come in with commas, replace with decimal format
event.latitude = event.latitude.replace(",", ".");
event.longitude = event.longitude.replace(",", ".");
event.datetime = calcDatetime(event.date, event.time);
if (!isValidDate(event.datetime)) {
discardedDomain.events.push({