cubehouse / themeparks

Unofficial API for accessing ride wait times and schedules for Disneyland, Disney World, Universal Studios, and many more parks
MIT License
538 stars 126 forks source link

GetOpeningTimes returning other park hours #276

Closed davidrothera closed 4 years ago

davidrothera commented 4 years ago

Park All WDW resorts (only ones I'm using)

Context

Describe the bug I have an instance of each of the parks so I can access info for each of them:

const ParkOptions = {
    scheduleDaysToReturn: 90,
};

const Epcot = new Themeparks.Parks.WaltDisneyWorldEpcot(ParkOptions);
const HollywoodStudios = new Themeparks.Parks.WaltDisneyWorldHollywoodStudios(ParkOptions);
const AnimalKingdom = new Themeparks.Parks.WaltDisneyWorldAnimalKingdom(ParkOptions);
const MagicKingdom = new Themeparks.Parks.WaltDisneyWorldMagicKingdom(ParkOptions);

When calling GetOpeningTimes() on any of these objects I get the opening hours for whichever is first in the list (in this case EPCOT) rather than the one requested.

If I re-order the creation of the park objects (e.g. make MK the first) then I get the hours for MK even when calling HollywoodStudios.GetOpeningHours() etc.

EDIT - This does actually happen with the other API methods like GetWaitTimes

This issue doesn't happen with GetWaitTimes() and that seems to support having the multiple objects all open at once.

Output

const Themeparks = require("themeparks");

const ParkOptions = {
    scheduleDaysToReturn: 1,
};

const Epcot = new Themeparks.Parks.WaltDisneyWorldEpcot(ParkOptions);
const HollywoodStudios = new Themeparks.Parks.WaltDisneyWorldHollywoodStudios(ParkOptions);
const AnimalKingdom = new Themeparks.Parks.WaltDisneyWorldAnimalKingdom(ParkOptions);
const MagicKingdom = new Themeparks.Parks.WaltDisneyWorldMagicKingdom(ParkOptions);

Epcot.GetOpeningTimes().then((schedule) => {
    console.log('EPCOT');
    console.log(schedule);
});

HollywoodStudios.GetOpeningTimes().then((schedule) => {
    console.log('HollywoodStudios');
    console.log(schedule);
});

AnimalKingdom.GetOpeningTimes().then((schedule) => {
    console.log('AnimalKingdom');
    console.log(schedule);
});

MagicKingdom.GetOpeningTimes().then((schedule) => {
    console.log('MagicKingdom');
    console.log(schedule);
});
~/D/wait_times ❯❯❯ NODE_DEBUG=themeparks node bug.js                                                                                                         ✘ 130
THEMEPARKS 3677: WaltDisneyWorldEpcot: Set useragent to Mozilla/5.0 (X11; U; Linux armv7l like Android; en-us) AppleWebKit/531.2+ (KHTML, like Gecko) Version/5.0 Safari/533.2+ Kindle/3.0+
THEMEPARKS 3677: Setting up database "/Users/david/Developer/wait_times/themeparks.db"
THEMEPARKS 3677: WaltDisneyWorldHollywoodStudios: Set useragent to Mozilla/5.0 (Linux; U; Android 2.3.3; en-us ; LS670 Build/GRI40) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1/UCBrowser/8.6.1.262/145/355
THEMEPARKS 3677: WaltDisneyWorldAnimalKingdom: Set useragent to Mozilla/5.0 (Linux; U; Android 1.6; en-us; SonyEricssonX10i Build/R1AA056) AppleWebKit/528.5  (KHTML, like Gecko) Version/3.1.2 Mobile Safari/525.20.1
THEMEPARKS 3677: WaltDisneyWorldMagicKingdom: Set useragent to Mozilla/5.0 (Linux; U; Android 4.1; en-us; sdk Build/MR1) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.1 Safari/534.30
THEMEPARKS 3677: CouchbaseChannelDisney[facilities_wdw]: Fetching initial state since 42868826
THEMEPARKS 3677: CouchbaseChannelDisney[facilities_wdw]: Initial state returned 0 document updates
THEMEPARKS 3677: CouchbaseChannelDisney[facilities_wdw]: Starting long-poll for live updates
THEMEPARKS 3677: FacilityChannel: No new facility data to bulk write to DB, skipping write
THEMEPARKS 3677: FacilityChannel: No new calendar data to bulk write to DB, skipping write
THEMEPARKS 3677: CouchbaseChannelDisney[facilities_wdw]: Starting long-poll from sequence 42868826
EPCOT
[
  {
    date: '2020-02-06',
    openingTime: '2020-02-06T09:00:00-05:00',
    closingTime: '2020-02-06T21:00:00-05:00',
    type: 'Operating',
    special: [ [Object] ]
  },
  {
    date: '2020-02-07',
    openingTime: '2020-02-07T09:00:00-05:00',
    closingTime: '2020-02-07T21:00:00-05:00',
    type: 'Operating'
  }
]
MagicKingdom
[
  {
    date: '2020-02-06',
    openingTime: '2020-02-06T09:00:00-05:00',
    closingTime: '2020-02-06T21:00:00-05:00',
    type: 'Operating',
    special: [ [Object] ]
  },
  {
    date: '2020-02-07',
    openingTime: '2020-02-07T09:00:00-05:00',
    closingTime: '2020-02-07T21:00:00-05:00',
    type: 'Operating'
  }
]
HollywoodStudios
[
  {
    date: '2020-02-06',
    openingTime: '2020-02-06T09:00:00-05:00',
    closingTime: '2020-02-06T21:00:00-05:00',
    type: 'Operating',
    special: [ [Object] ]
  },
  {
    date: '2020-02-07',
    openingTime: '2020-02-07T09:00:00-05:00',
    closingTime: '2020-02-07T21:00:00-05:00',
    type: 'Operating'
  }
]
AnimalKingdom
[
  {
    date: '2020-02-06',
    openingTime: '2020-02-06T09:00:00-05:00',
    closingTime: '2020-02-06T21:00:00-05:00',
    type: 'Operating',
    special: [ [Object] ]
  },
  {
    date: '2020-02-07',
    openingTime: '2020-02-07T09:00:00-05:00',
    closingTime: '2020-02-07T21:00:00-05:00',
    type: 'Operating'
  }
]
davidrothera commented 4 years ago

Opening hours for today (6th)

Screenshot 2020-02-06 at 08 07 55
davidrothera commented 4 years ago

UPDATE: This seems to actually happen also on GetWaitTimes as well:

~/D/wait_times ❯❯❯ NODE_DEBUG=themeparks node bug2.js                                                                                                ✘ 130 master ◼
THEMEPARKS 10995: WaltDisneyWorldEpcot: Set useragent to Mozilla/5.0 (Linux; U; Android 2.2; en-us; ADR6300 Build/FRF91) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1
THEMEPARKS 10995: Setting up database "/Users/david/Developer/wait_times/themeparks.db"
THEMEPARKS 10995: WaltDisneyWorldHollywoodStudios: Set useragent to Mozilla/5.0 (Linux; U; Android 1.1; en-gb; dream) AppleWebKit/525.10  (KHTML, like Gecko) Version/3.0.4 Mobile Safari/523.12.2
THEMEPARKS 10995: WaltDisneyWorldAnimalKingdom: Set useragent to Mozilla/5.0 (Linux; U; Android 1.5; de-ch; HTC Hero Build/CUPCAKE) AppleWebKit/528.5  (KHTML, like Gecko) Version/3.1.2 Mobile Safari/525.20.1
THEMEPARKS 10995: WaltDisneyWorldMagicKingdom: Set useragent to Mozilla/5.0 (Linux; U; Android 2.3.4; en-us; BNTV250 Build/GINGERBREAD) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Safari/533.1
THEMEPARKS 10995: CouchbaseChannelDisney[facilitystatus_wdw]: Fetching initial state since 42860266
THEMEPARKS 10995: CouchbaseChannelDisney[facilitystatus_wdw]: Initial state returned 0 document updates
THEMEPARKS 10995: CouchbaseChannelDisney[facilitystatus_wdw]: Starting long-poll for live updates
THEMEPARKS 10995: CouchbaseChannelDisney[facilitystatus_wdw]: Starting long-poll from sequence 42860266
THEMEPARKS 10995: CouchbaseChannelDisney[facilities_wdw]: Fetching initial state since 42868826
THEMEPARKS 10995: CouchbaseChannelDisney[facilities_wdw]: Initial state returned 0 document updates
THEMEPARKS 10995: CouchbaseChannelDisney[facilities_wdw]: Starting long-poll for live updates
THEMEPARKS 10995: FacilityChannel: No new facility data to bulk write to DB, skipping write
THEMEPARKS 10995: FacilityChannel: No new calendar data to bulk write to DB, skipping write
THEMEPARKS 10995: CouchbaseChannelDisney[facilities_wdw]: Starting long-poll from sequence 42868826
EPCOT
{
  meta: {
    fastPassStartTime: null,
    fastPassEndTime: null,
    area: 'Future World',
    longitude: -81.552248,
    latitude: 28.373592
  },
  id: 'WaltDisneyWorldEpcot_20194',
  name: "Soarin' Around the World",
  active: false,
  waitTime: 0,
  fastPass: true,
  lastUpdate: '2020-02-06T08:24:20.045Z',
  status: 'Closed'
}
AnimalKingdom
{
  meta: {
    fastPassStartTime: null,
    fastPassEndTime: null,
    area: 'Future World',
    longitude: -81.552248,
    latitude: 28.373592
  },
  id: 'WaltDisneyWorldAnimalKingdom_20194',
  name: "Soarin' Around the World",
  active: false,
  waitTime: 0,
  fastPass: true,
  lastUpdate: '2020-02-06T08:24:20.046Z',
  status: 'Closed'
}
MagicKingdom
{
  meta: {
    fastPassStartTime: null,
    fastPassEndTime: null,
    area: 'Future World',
    longitude: -81.552248,
    latitude: 28.373592
  },
  id: 'WaltDisneyWorldMagicKingdom_20194',
  name: "Soarin' Around the World",
  active: false,
  waitTime: 0,
  fastPass: true,
  lastUpdate: '2020-02-06T08:24:20.043Z',
  status: 'Closed'
}
HollywoodStudios
{
  meta: {
    fastPassStartTime: null,
    fastPassEndTime: null,
    area: 'Future World',
    longitude: -81.552248,
    latitude: 28.373592
  },
  id: 'WaltDisneyWorldHollywoodStudios_20194',
  name: "Soarin' Around the World",
  active: false,
  waitTime: 0,
  fastPass: true,
  lastUpdate: '2020-02-06T08:24:20.048Z',
  status: 'Closed'
}
davidrothera commented 4 years ago

Found the issue, because I was passing in ParkOptions it was being mutated with the settings of the first park and then passed down and overriding the settings of the other parks.