Commit 2a6a1f8e authored by Volker Krause's avatar Volker Krause
Browse files

Convert location info to the right type when necessary

In some cases Eventbrite is putting in a single string rather than
a full place object it seems.
parent 55d15b27
Pipeline #91799 passed with stage
in 9 minutes and 54 seconds
......@@ -7,9 +7,19 @@ function fixAddress(content, node) {
if (node.result.length != 1) {
return;
}
var res = node.result[0];
// location can be a string rather than a place object
if (typeof res.reservationFor.location === "string") {
var place = JsonLd.newObject("Place");
place.name = res.reservationFor.location;
res.reservationFor.location = place;
}
// streetAddress duplicates city and zip code without proper separation in
// about half their emails...
var res = node.result[0];
if (!res.reservationFor.location.address) {
return res;
}
var addr = res.reservationFor.location.address;
if (addr.streetAddress.endsWith(addr.addressLocality)) {
addr.streetAddress = addr.streetAddress.substr(0, addr.streetAddress.length - addr.addressLocality.length).trim();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment