Elaniobro / MMM-nyc-transit

MTA transit module for Magic Mirror
MIT License
21 stars 14 forks source link

[🐛 BUG] - Uptown/Downtown filters do not work if multiple modules sections are defined #92

Closed georgyo closed 1 year ago

georgyo commented 1 year ago

Describe the bug A clear and concise description of what the bug is.

To Reproduce Steps to reproduce the behavior:

  1. Define two separate module blocks in your config.js
        {
            module: 'MMM-nyc-transit',
            position: "bottom_left",
            header: "Next Train -> Manhattan",
            config: {
                apiKey: 'SCRUBED',
                displayType: 'list',
                mtaType: 'train',
                stations: [{
                        // Dekalb Ave
                        stationId: 26,
                        walkingTime: 5,
                        dir: {
                            upTown: true,
                            downTown: false
                        }
                    },
                    {
                        // Jay Street Metro Tech
                        stationId: 636,
                        walkingTime: 5,
                        dir: {
                            upTown: true,
                            downTown: false
                        }
                    }
                ],
                updateInterval: 300000
            }
        },
        {
            module: 'MMM-nyc-transit',
            position: "bottom_right",
            header: "Next Train -> Brooklyn",
            config: {
                apiKey: 'SCRUBED',
                displayType: 'list',
                mtaType: 'train',
                stations: [{
                        // Dekalb Ave
                        stationId: 26,
                        walkingTime: 5,
                        dir: {
                            upTown: false,
                            downTown: true 
                        }
                    },
                    {
                        // Jay Street Metro Tech
                        stationId: 636,
                        walkingTime: 5,
                        dir: {
                            upTown: false,
                            downTown: true 
                        }
                    }
                ],
                updateInterval: 300000
            }
        },

Expected behavior The bottom left of the screen will only show upTown trains, and the bottom right will only show downTown trains.

Actual behavior Last module defined wins, showing only downtown trains.

Screenshots image

Platform (please complete the following information):

Additional context Removing the second module block does do the correct thing, but ideally I want to see uptown and downtown trains in separate blocks.

eqpaisley commented 1 year ago

I've also been struggling with a VERSION of this problem. I cannot ever get uptown trains to display first. If I display ONLY uptown trains, that works. But if I display both uptown and downtown, downtown are always first irrespective of what order I list them in my config.js.

I suspect this is somehow related to this bug ?

Elaniobro commented 1 year ago

The intent of this module was never to have multiple instances running in parallel, but to show the uptown/downtown trains for each line within the module. I do not plan to update it to accommodate, but PR's are welcomed.