Skip to content

Commit

Permalink
Fixed the double entry problem.
Browse files Browse the repository at this point in the history
  • Loading branch information
Damien Katz authored and Damien Katz committed Oct 16, 2009
1 parent ed232e1 commit a4d1634
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 6 deletions.
25 changes: 20 additions & 5 deletions _attachments/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@
var drawtimeout;
var ignoreViewEvent = true;
var user_profile_doc = {};
var currently_loading_events = false;
var load_events_again = false;
function trim(str) {
return str.replace(/^\s*/, "").replace(/\s*$/, "");
}
Expand Down Expand Up @@ -207,19 +209,21 @@
right: 'month,basicWeek,basicDay'
},
events: function(start, end, callback) {
if (currently_loading_events) {
load_events_again = true;
return;
}
currently_loading_events = true;
app.db.info({success: function(db_info) {
if (c_xhr) {
c_xhr.onreadystatechange = null;
c_xhr.abort();
}

c_xhr = jQuery.ajaxSettings.xhr();
c_xhr.open("GET", app.db.uri+"_changes?feed=longpoll&since="+db_info.update_seq, true);
c_xhr.send("");
c_xhr.onreadystatechange = function() {
if(c_xhr.readyState == 4) {
setTimeout(function() {
$('#calendar').fullCalendar('refetchEvents');
}, 100);
}, 10);
}
};
var user_name = trim($("#user").val());
Expand All @@ -243,6 +247,13 @@
function add_user_cals(cals, uniqueEvents) {
if (cals.length == 0) {
callback(uniqueEvents);
if (load_events_again) {
setTimeout(function() {
$('#calendar').fullCalendar('refetchEvents');
}, 10);
}
load_events_again = false;
currently_loading_events = false;
return;
}
var name = cals.pop();
Expand Down Expand Up @@ -343,6 +354,7 @@

function init_othercals(cals) {
$("#othercals").val(cals.join(","));
othercals = cals;
// TODO display tags and calendars
};

Expand All @@ -361,6 +373,9 @@
});
}
}
options.blur = function(input) {
save_profile();
}
$("#othercals").tagbox(options)
}

Expand Down
3 changes: 2 additions & 1 deletion views/by_user_date/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ function(doc) {
}
}
function emitUserMonthly(doc, user, start, end) {
while (start <= end) {
var totalEmitted = 0;
while (totalEmitted++ < 36 && start <= end) {
var d = new Date(start);
emit([user, d.getFullYear(), d.getMonth()], doc);
if (d.getMonth() == 11) {
Expand Down

0 comments on commit a4d1634

Please sign in to comment.