umts / BusInfoBoard

A place to view bus arrival information from Avail's JSON feed
Apache License 2.0
16 stars 3 forks source link

Not all alerts appearing #28

Closed sherson closed 9 years ago

sherson commented 9 years ago

When rendering multiple stops, it display alerts only for the last stop. For example, http://umts.github.io/BusInfoBoard/?&mobile=true&stops=73+63 displays the alerts for stop 63. If I swap 73 and 63, I see alerts for 73.

Also, if there is an alert in the feed that is not route specific, at least the next route specific alert in the feed does not appear.

For instance, the Move-Out Day alert (70) below is not route specific:

<PublicMessage>
    <MessageId>24</MessageId>
    <Message>
        Routes 34 and 35 are servicing Admissions intermittently (due to ongoing 
        construction). Please catch buses at the nearby temporary stop on Olympia Dr.
    </Message>
    <FromDate>2015-03-23T00:00:00</FromDate>
    <ToDate>2015-05-09T00:00:00</ToDate>
    <FromTime>2015-03-06T00:00:00</FromTime>
    <ToTime>2015-03-06T23:59:59</ToTime>
    <Priority>High</Priority>
    <DaysOfWeek>
        Monday Tuesday Wednesday Thursday Friday Saturday Sunday
    </DaysOfWeek>
    <Published>true</Published>
    <PublicAccess>1</PublicAccess>
    <Routes>
        <int>20034</int>
        <int>20035</int>
    </Routes>
    <Signs/>
</PublicMessage>
<PublicMessage>
    <MessageId>69</MessageId>
    <Message>
        Route 30 is bypassing Valley Medical due to construction. Please catch the 
        bus at the Hall Dr stop on Route 9
    </Message>
    <FromDate>2015-05-06T00:00:00</FromDate>
    <ToDate>2015-06-06T00:00:00</ToDate>
    <FromTime>2015-05-06T00:00:00</FromTime>
    <ToTime>2015-05-06T23:59:59</ToTime>
    <Priority>Medium</Priority>
    <DaysOfWeek>
        Monday Tuesday Wednesday Thursday Friday Saturday Sunday
    </DaysOfWeek>
    <Published>true</Published>
    <PublicAccess>1</PublicAccess>
    <Routes>
        <int>20030</int>
    </Routes>
    <Signs/>
</PublicMessage>
<PublicMessage>
    <MessageId>70</MessageId>
    <Message>
        Due to Move-Out Day, Routes 34 & 35 are bypassing Orchard Hill/Upper Central. 
        Please catch buses at temp bus stops on E. Pleasant St.
    </Message>
    <FromDate>2015-05-07T00:00:00</FromDate>
    <ToDate>2015-06-07T00:00:00</ToDate>
    <FromTime>2015-05-07T00:00:00</FromTime>
    <ToTime>2015-05-07T23:59:59</ToTime>
    <Priority>Medium</Priority>
    <DaysOfWeek>
        Monday Tuesday Wednesday Thursday Friday Saturday Sunday
    </DaysOfWeek>
    <Published>true</Published>
    <PublicAccess>1</PublicAccess>
    <Routes/>
    <Signs/>
</PublicMessage>
<PublicMessage>
    <MessageId>71</MessageId>
    <Message>
        Due to UMass commencement, Route 38 will bypass Amherst center & UMass 
        between 1:30 & 7 PM on Friday, 5/8. Please catch buses at Amherst College.
    </Message>
    <FromDate>2015-05-07T00:00:00</FromDate>
    <ToDate>2015-05-08T00:00:00</ToDate>
    <FromTime>2015-05-07T00:00:00</FromTime>
    <ToTime>2015-05-07T23:59:59</ToTime>
    <Priority>Medium</Priority>
    <DaysOfWeek>
        Monday Tuesday Wednesday Thursday Friday Saturday Sunday
    </DaysOfWeek>
    <Published>true</Published>
    <PublicAccess>1</PublicAccess>
    <Routes>
        <int>20038</int>
    </Routes>
    <Signs/>
</PublicMessage>

The commencement alert (71) was not appearing. Once I made Move-Out Day routes-specific, the commencement alert appeared.

(of course, that Move-Out Day should've been specific to Routes 34 and 35... and both 34/35 alerts shouldn't be there anyway as shuttle ended yesterday, so I've removed them)

sherson commented 9 years ago

Also, I'll mention to Avail that & isn't dealt with properly in their XML.

werebus commented 9 years ago

Probably this break; isn't supposed to be there?

bcspragu commented 9 years ago

The break; definitely shouldn't have been there, though that wasn't the issue here. The issue was that loadMessages was being called once per table load, which happens multiple times per refresh, and it was only considering the route_ids from the last one (which is why you see that switching the order breaks it). I've implemented a solution here.

sherson commented 9 years ago

:+1: