Page MenuHomePhabricator

D12980.diff
No OneTemporary

D12980.diff

diff --git a/webroot/rsrc/js/application/calendar/behavior-day-view.js b/webroot/rsrc/js/application/calendar/behavior-day-view.js
--- a/webroot/rsrc/js/application/calendar/behavior-day-view.js
+++ b/webroot/rsrc/js/application/calendar/behavior-day-view.js
@@ -7,6 +7,7 @@
var hourly_events = config.hourlyEvents;
var today_events = config.todayEvents;
+
function findTodayClusters() {
var events = today_events.sort(function(x, y){
return (x.eventStartEpoch - y.eventStartEpoch);
@@ -14,34 +15,42 @@
var clusters = [];
- events.forEach(function(e){
+ for (var i=0; i < events.length; i++) {
+ var today_event = events[i];
+
var destination_cluster_index = null;
- var event_start = e.eventStartEpoch - (30*60);
- var event_end = e.eventEndEpoch + (30*60);
+ var event_start = today_event.eventStartEpoch - (30*60);
+ var event_end = today_event.eventEndEpoch + (30*60);
- clusters.forEach(function(cluster, index){
- for(var i=0; i < cluster.length; i++) {
- var clustered_event = cluster[i];
+ for (var j=0; j < clusters.length; j++) {
+ var cluster = clusters[j];
+
+ for(var k=0; k < cluster.length; k++) {
+ var clustered_event = cluster[k];
var compare_event_start = clustered_event.eventStartEpoch;
var compare_event_end = clustered_event.eventEndEpoch;
if (event_start < compare_event_end &&
event_end > compare_event_start) {
- destination_cluster_index = index;
+ destination_cluster_index = j;
break;
}
}
- });
+
+ if (destination_cluster_index !== null) {
+ break;
+ }
+ }
if (destination_cluster_index !== null) {
- clusters[destination_cluster_index].push(e);
+ clusters[destination_cluster_index].push(today_event);
destination_cluster_index = null;
} else {
var next_cluster = [];
- next_cluster.push(e);
+ next_cluster.push(today_event);
clusters.push(next_cluster);
}
- });
+ }
return clusters;
}

File Metadata

Mime Type
text/plain
Expires
Tue, Nov 19, 7:39 PM (13 h, 53 m ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6718660
Default Alt Text
D12980.diff (2 KB)

Event Timeline