From 453fcf07e369fc8610089e8d7bd12aa70c6854ac Mon Sep 17 00:00:00 2001 From: Adam Shaw Date: Mon, 11 Oct 2010 14:16:34 -0700 Subject: [PATCH] fixed issues 554, 586, and 616 --- src/EventManager.js | 68 +++++++++++++++++------------- tests/issue_417_refetchEvents.html | 1 - tests/issue_554.html | 50 ++++++++++++++++++++++ tests/issue_586_refetchEvents.html | 57 +++++++++++++++++++++++++ tests/issue_616.html | 56 ++++++++++++++++++++++++ 5 files changed, 202 insertions(+), 30 deletions(-) create mode 100644 tests/issue_554.html create mode 100644 tests/issue_586_refetchEvents.html create mode 100644 tests/issue_616.html diff --git a/src/EventManager.js b/src/EventManager.js index b3b67e4..a5bb7f4 100644 --- a/src/EventManager.js +++ b/src/EventManager.js @@ -26,6 +26,7 @@ function EventManager(options, eventSources) { // locals + var fetchID = 0; var eventStart, eventEnd; var events = []; var loadingLevel = 0; @@ -64,45 +65,49 @@ function EventManager(options, eventSources) { // Fetch from ALL sources. Clear 'events' array and populate function fetchEvents(callback) { - var view = getView(); events = []; - eventStart = cloneDate(view.visStart); - eventEnd = cloneDate(view.visEnd); - var queued = eventSources.length, - sourceDone = function() { + fetchEventSources(eventSources, callback); + } + + + // appends to the events array + function fetchEventSources(sources, callback) { + var savedID = ++fetchID; + var queued = sources.length; + var view = getView(); + eventStart = cloneDate(view.visStart); // we don't need to make local copies b/c + eventEnd = cloneDate(view.visEnd); // eventStart/eventEnd is only assigned/manipulated here + function sourceDone(source, sourceEvents) { + if (savedID == fetchID && eventStart >= view.visStart && eventEnd <= view.visEnd) { + // same fetchEventSources call, and still in correct date range + if ($.inArray(source, eventSources) != -1) { // source hasn't been removed since we started + for (var i=0; i - + + + + + + +
+ + diff --git a/tests/issue_586_refetchEvents.html b/tests/issue_586_refetchEvents.html new file mode 100644 index 0000000..10f7b38 --- /dev/null +++ b/tests/issue_586_refetchEvents.html @@ -0,0 +1,57 @@ + + + + + + + + + + +
+ + diff --git a/tests/issue_616.html b/tests/issue_616.html new file mode 100644 index 0000000..45f78b5 --- /dev/null +++ b/tests/issue_616.html @@ -0,0 +1,56 @@ + + + + + + + + + + +
+ +