Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14016160
D12980.id31285.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D12980.id31285.diff
View Options
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
@@ -14,37 +14,47 @@
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);
+
+ for (var j=0; j < clusters.length; j++) {
+ var cluster = clusters[j];
- clusters.forEach(function(cluster, index){
- for(var i=0; i < cluster.length; i++) {
- var clustered_event = cluster[i];
+ 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;
}
var today_clusters = findTodayClusters();
+
+ JX.log(today_clusters);
});
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Nov 5, 6:26 AM (2 w, 1 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6727567
Default Alt Text
D12980.id31285.diff (1 KB)
Attached To
Mode
D12980: Swapping out foreach out of behavior
Attached
Detach File
Event Timeline
Log In to Comment