Clicking some events on list in BTM opens blank page

Go to the home page and search for London.

On the map, if any of the first 9 events on the event list is clicked then a blank page is opened instead of the event details.

This doesn’t happen for the rest of the events in the London list but does happen for some events outside of London.

Perhaps there is some missing data when the events are created?

I missed this post Bob, but actually was just exploring the same issue. it seems the old database and new one don’t appear to be aligning correctly. I’ve just asked @zofrex and @tmcnulty if they can look into it. If you have any ideas what the cause/solution is please tag them here.

Great spot by the way

creating a post and an entry in the database is all from the React side. Discourse comes in after that and we create three new hidden threads

then when you visit them after they are created they load up just fine. so perhaps there is nothing wrong with the database, just for some reason the redirect doesn’t work.

now i think about it, the categories aren’t loading correctly and i was planning to work on that later tonight. maybe that could be causing this. (the filters don’t show in the main map view, but i think i can fix that by updating the categories code in i18n to match the one for PHM)

Ok, so changing the categories changed where our platform navigates to when looking for a post (user clicks to open the page on a post on the map). Unfortunately it looks to be searching for posts created using the old system, rather than ones created using the platform after it was changed to the exact same code as PHM.

So the posts are still there on the map, but the filters cant find them and we can’t open the pages, presumably because the database has them listed somewhere and the app expects to find them somewhere else. the map still shows the correct categories, but the filter also can’t see them.

Here’s the code: https://github.com/focallocal/fl-maps/blob/master_withoutDCS/imports/both/i18n/en/btm/categories.json

It is now functionally identical to PHM which is working correctly, so i believe the issue has to be in how this page is hooking up with the database. Likely because a lot has changed since many posts on here were made.

@AndyatFocallocal The categories.json file you’re editing is in the master_withoutDCS branch but the code thats live is in deploy-btm.

oh. i didn’t know that. thanks for letting me know, we’ll need to update the documentation as right now everyone is being directed to the wrong branch to work on it.

thanks for letting me know

Ok, thanks @bob the categories are working as expected now.

The database bug remains, it seems the issue is that anything posted before the recent update can’t be opened. Anything new is loading fine. @zofrex can you see anything in the call to the database?

These are the error codes:

8867a2d12f1f92bbca0f36afcc6c75f13d829a86.js?meteor_js_resource=true:129 TypeError: Cannot read property 'toDateString' of null
at t.default (8867a2d12f1f92bbca0f36afcc6c75f13d829a86.js?meteor_js_resource=true:129)
at beginWork (8867a2d12f1f92bbca0f36afcc6c75f13d829a86.js?meteor_js_resource=true:129)
at o (8867a2d12f1f92bbca0f36afcc6c75f13d829a86.js?meteor_js_resource=true:129)
at i (8867a2d12f1f92bbca0f36afcc6c75f13d829a86.js?meteor_js_resource=true:129)
at k (8867a2d12f1f92bbca0f36afcc6c75f13d829a86.js?meteor_js_resource=true:129)
at w (8867a2d12f1f92bbca0f36afcc6c75f13d829a86.js?meteor_js_resource=true:129)
at v (8867a2d12f1f92bbca0f36afcc6c75f13d829a86.js?meteor_js_resource=true:129)
at interactiveUpdates (8867a2d12f1f92bbca0f36afcc6c75f13d829a86.js?meteor_js_resource=true:129)
at kn (8867a2d12f1f92bbca0f36afcc6c75f13d829a86.js?meteor_js_resource=true:129)

wr @ 8867a2d12f1f92bbca0f36afcc6c75f13d829a86.js?meteor_js_resource=true:129
commitErrorLogging @ 8867a2d12f1f92bbca0f36afcc6c75f13d829a86.js?meteor_js_resource=true:129
E @ 8867a2d12f1f92bbca0f36afcc6c75f13d829a86.js?meteor_js_resource=true:129
k @ 8867a2d12f1f92bbca0f36afcc6c75f13d829a86.js?meteor_js_resource=true:129
w @ 8867a2d12f1f92bbca0f36afcc6c75f13d829a86.js?meteor_js_resource=true:129
v @ 8867a2d12f1f92bbca0f36afcc6c75f13d829a86.js?meteor_js_resource=true:129
interactiveUpdates @ 8867a2d12f1f92bbca0f36afcc6c75f13d829a86.js?meteor_js_resource=true:129
kn @ 8867a2d12f1f92bbca0f36afcc6c75f13d829a86.js?meteor_js_resource=true:129

8867a2d12f1f92bbca0f36afcc6c75f13d829a86.js?meteor_js_resource=true:129 Uncaught TypeError: Cannot read property 'toDateString' of null
at t.default (8867a2d12f1f92bbca0f36afcc6c75f13d829a86.js?meteor_js_resource=true:129)
at beginWork (8867a2d12f1f92bbca0f36afcc6c75f13d829a86.js?meteor_js_resource=true:129)
at o (8867a2d12f1f92bbca0f36afcc6c75f13d829a86.js?meteor_js_resource=true:129)
at i (8867a2d12f1f92bbca0f36afcc6c75f13d829a86.js?meteor_js_resource=true:129)
at k (8867a2d12f1f92bbca0f36afcc6c75f13d829a86.js?meteor_js_resource=true:129)
at w (8867a2d12f1f92bbca0f36afcc6c75f13d829a86.js?meteor_js_resource=true:129)
at v (8867a2d12f1f92bbca0f36afcc6c75f13d829a86.js?meteor_js_resource=true:129)
at interactiveUpdates (8867a2d12f1f92bbca0f36afcc6c75f13d829a86.js?meteor_js_resource=true:129)
at kn (8867a2d12f1f92bbca0f36afcc6c75f13d829a86.js?meteor_js_resource=true:129)

t.default @ 8867a2d12f1f92bbca0f36afcc6c75f13d829a86.js?meteor_js_resource=true:129
beginWork @ 8867a2d12f1f92bbca0f36afcc6c75f13d829a86.js?meteor_js_resource=true:129
o @ 8867a2d12f1f92bbca0f36afcc6c75f13d829a86.js?meteor_js_resource=true:129
i @ 8867a2d12f1f92bbca0f36afcc6c75f13d829a86.js?meteor_js_resource=true:129
k @ 8867a2d12f1f92bbca0f36afcc6c75f13d829a86.js?meteor_js_resource=true:129
w @ 8867a2d12f1f92bbca0f36afcc6c75f13d829a86.js?meteor_js_resource=true:129
v @ 8867a2d12f1f92bbca0f36afcc6c75f13d829a86.js?meteor_js_resource=true:129
interactiveUpdates @ 8867a2d12f1f92bbca0f36afcc6c75f13d829a86.js?meteor_js_resource=true:129
kn @ 8867a2d12f1f92bbca0f36afcc6c75f13d829a86.js?meteor_js_resource=true:129

8867a2d12f1f92bbca0f36afcc6c75f13d829a86.js?meteor_js_resource=true:129 Uncaught TypeError: Cannot read property 'panTo' of null
at 8867a2d12f1f92bbca0f36afcc6c75f13d829a86.js?meteor_js_resource=true:129

actually, we could search the codebase for those values but i’m fairly sure we are going to find them in i18n.

Does anyone a good software where you can compare code side-by-side? Especially one which highlights differences? I strongly suspect some of the BTM code in i18n had fallen behind PHM and so i’ll need to copy/paste over the code from PHM and then add in the text that is currently in BTM to match the headers in BTMs i18n file

I searched for references to those errors and toDateString is only using in here:

Maybe the events are missing starting and ending dates in the database. Can someone check it? Could we update the dates manually or just remove the events without starting and ending dates?

1 Like

Thanks Bob. I check i18n yesterday and my initial theory that it was the cause looks inaccurate. we’ll need @zofrex or @tmcnulty to check and update the fields in the database i think.

Hey Andy does this correspond with you turning off the Vultr server? Let’s turn that back on and see if that magically fixes it.

I looked at the error.

TypeError: Cannot read property 'toDateString' of null

It’s trying to convert nothing into a DateString so the information it’s either retrieving is empty or it’s not retrieving anything.

First item is “The Spectrum Centre.”

{
    "_id": "TfXDunjRkyRTzkbBT",
    "name": "The Spectrum Centre",
    "address": {
        "name": "Greenland Street 9, England, United Kingdom",
        "location": {
            "type": "Point",
            "coordinates": [
                -0.1413906,
                51.53820320000001
            ]
        }
    },
    "findHints": "none",
    "overview": "The Spectrum Centre is based at, 6-9 Greenland Street, London NW1 0ND. It is commissioned by Camden Council and run by Equinox.",
    "description": "Services available include general and emergency advice sessions, integrated services for people with alcohol problems and other substance misuse problems, showers and laundry services, mail and correspondence service, housing and benefit advice, a doctor and nurse for h",
    "organiser": {
        "_id": "zQMSyWBfDxg3iDKc3",
        "name": "Andy Focallocal"
    },
    "categories": [
        {
            "name": "Shower",
            "color": "#14fffc"
        }
    ],
    "when": {
        "startingDate": {
            "$date": "2018-03-15T00:00:00.000Z"
        },
        "endingDate": null,
        "startingTime": "9:00",
        "endingTime": "18:00",
        "multipleDays": true,
        "days": [
            null,
            {
                "day": "Monday",
                "startingTime": "9:00",
                "endingTime": "18:00"
            },
            {
                "day": "Tuesday",
                "startingTime": "9:00",
                "endingTime": "18:00"
            },
            {
                "day": "Wednesday",
                "startingTime": "9:00",
                "endingTime": "18:00"
            },
            {
                "day": "Thursday",
                "startingTime": "9:00",
                "endingTime": "18:00"
            },
            {
                "day": "Friday",
                "startingTime": "9:00",
                "endingTime": "18:00"
            },
            null
        ]
    },
    "createdAt": {
        "$date": "2018-06-17T12:30:12.074Z"
    },
    "engagement": {
        "limit": 0,
        "attendees": []
    }
}

Perhaps it’s because “endingDate” is null. I’m going to check other items that don’t work and those that do for the structure of their data.

Yes that looks like that’s it.

{
    "_id": "PkhwqjWnCZCtL4xMr",
    "name": "Crisis Skylight",
    "address": {
        "name": "Commercial Street 66, England, United Kingdom",
        "location": {
            "type": "Point",
            "coordinates": [
                -0.0739266,
                51.5181011
            ]
        }
    },
    "findHints": "https://www.crisis.org.uk/get-help/london/",
    "overview": "If you are homeless, are at immediate risk of becoming homeless, or have been homeless in the last two years, you can access our services for free.",
    "description": "We offer education, training and support at our centre in London. Come to an induction at 11am seven days a week. There's no need to book, just turn up.",
    "organiser": {
        "_id": "LTMSiYLPWLo48QrSD",
        "name": "Maria Tkachuk"
    },
    "categories": [
        {
            "name": "Community Support (offers)",
            "color": "#fe0a0a"
        }
    ],
    "when": {
        "startingDate": {
            "$date": "2017-05-18T23:00:00.000Z"
        },
        "endingDate": null,
        "multipleDays": true,
        "days": [
            {
                "day": "Sunday",
                "startingTime": "11:00",
                "endingTime": "17:00"
            },
            {
                "day": "Monday",
                "startingTime": "9:00",
                "endingTime": "20:00"
            },
            {
                "day": "Tuesday",
                "startingTime": "9:00",
                "endingTime": "20:00"
            },
            {
                "day": "Wednesday",
                "startingTime": "9:00",
                "endingTime": "20:00"
            },
            {
                "day": "Thursday",
                "startingTime": "9:00",
                "endingTime": "20:00"
            },
            {
                "day": "Friday",
                "startingTime": "9:00",
                "endingTime": "18:00"
            },
            {
                "day": "Saturday",
                "startingTime": "11:00",
                "endingTime": "17:00"
            }
        ]
    },
    "createdAt": {
        "$date": "2017-05-19T14:37:40.522Z"
    },
    "engagement": {
        "limit": 0,
        "attendees": []
    }
}

One that works:

{
    "_id": "kkq3tnPiu5stwHDLZ",
    "organiser": {
        "_id": "F2DCZWt5EKZxpBs82",
        "name": "Richard Barclay"
    },
    "engagement": {
        "limit": 1000,
        "attendees": []
    },
    "createdAt": {
        "$date": "2019-11-21T11:56:46.601Z"
    },
    "when": {
        "startingTime": null,
        "endingTime": null,
        "recurring": null,
        "repeat": false,
        "startingDate": {
            "$date": "2019-11-21T12:00:00.000Z"
        },
        "multipleDays": true,
        "days": [
            false,
            {
                "day": "Monday",
                "startingTime": "9:00",
                "endingTime": "14:30"
            },
            false,
            {
                "day": "Wednesday",
                "startingTime": "9:00",
                "endingTime": "14:30"
            },
            false,
            {
                "day": "Friday",
                "startingTime": "9:00",
                "endingTime": "14:00"
            }
        ],
        "endingDate": {
            "$date": "2019-11-21T14:56:46.755Z"
        }
    },
    "address": {
        "name": "Clarence Road, Bognor Regis PO21 1JT, UK",
        "location": {
            "type": "Point",
            "coordinates": [
                -0.6701347000000624,
                50.7835534
            ]
        }
    },
    "categories": [
        {
            "name": "Food",
            "color": "#e322e9"
        },
        {
            "name": "Shower",
            "color": "#14fffc"
        },
        {
            "name": "Shelters",
            "color": "#74fe6a"
        }
    ],
    "name": "Stonepillow Bognor Regis Hub",
    "overview": "The Stonepillow Bognor Hub is located in Glenlogie, Clarence Road, Bognor Regis and offers support to homeless and vulnerable people within the Arun District.",
    "description": "Snacks, a light lunch, and hot drinks are provided. Project workers are available to offer advice and support to people wishing to make positive changes to their lives. The Hub also provides emergency support such as clothing, washing and shower facilities for those that are street homeless in the Arun District.\n\nThe Hub also provides crisis accommodation for new rough sleepers and acts as the Arun Districts Severe Weather Emergency Provision (SWEP), when night-time temperatures are predicted to drop to below zero degrees for three consecutive nights.\n\nIf you need support when the Hub is closed, please contact Bognor Hostel on 01243 214058.",
    "findHints": "Just turn up\n\nTel: 07734 558960/07515 328973\n\nhttps://stonepillow.org.uk/projects/stonepillow-bognor-regis-hub/"
}

I agree, this is a really good find. Let’s open a task to ensure logic is added to ensure events must have an ending date when created, or add a workflow for events to be repeating and this value be ignored. Once that logic is added I can manually inject the required value into this field.

What’s the intended function here? Would most events end?

I wouldn’t recommend simply setting new events to have an ending date an arbitrary date in the far distance.

1 Like

Ok, i think i might know whats happened

We used to require users to set an end date. that’s kind of odd if you’re posting a shelter for example as the user isn’t likely to know when it’ll stop being a shelter, so we added a button in the date selector for ‘forever/unknown’

That doesn’t appear to be present anymore so i’m going to assume its been pushed to the wrong branch, and so perhaps the BTM database is finding an option in the date field which is not allowed as an option in the codebase.

So a lot of things posted on the map wouldn’t have an end date. The change that was coded just added a button next to the end date users could click which would keep the posts on the map indefintely

@tmcnulty it looks like we need to edit something so the codebase accepts a ‘null’ ending date to mean it should stay on the map forever. Does that sound correct to you? I’ve messaged Arty as i’m sure he created the forever/unknown button which is missing now. Hopefully he/we can find it and push it to the current branches and that’ll fix the issue.

Ok try to identify why that work got lost in the way that. Do you remember anything about it that’d help you find the PR?

Is this it? https://github.com/focallocal/fl-maps/pull/913

No, i don’t think thats it… although it is very similar. That one looks to be in the code, the 1st code added is here at line 362

I’d look for the words ‘forever’. I had a little look earlier on the masterwithout_DCS branch and didn’t find it. Can we see all commits made to our Focallocal organisation perhaps?

Here it is in Trello: https://trello.com/c/zQDzkGbT/505-create-always-button-on-time-date-modal-and-set-the-special-category-to-default-to-it

Here’s the Issue in Github. Doesn’t seem to be linked to a PR though: https://github.com/focallocal/fl-maps/issues/890

Hey guys, this should fix it. Tested locally with the “Crisis Skylight” example event that Tom posted. Just needed to move the problem statement down below the part of the function that returns when the event is a multipleDays: true event (this is the only leftover situation when endingDate can be null in the database I believe)

1 Like

You’re amazing Arty, thank you :star2: