Modified: branches/event_logging/app/helpers/application_helper.rb (2035 => 2036)
--- branches/event_logging/app/helpers/application_helper.rb 2008-12-05 16:27:55 UTC (rev 2035)
+++ branches/event_logging/app/helpers/application_helper.rb 2008-12-05 17:57:35 UTC (rev 2036)
@@ -1743,10 +1743,6 @@
################ GROUPING ###############
# going backwards; events with smaller indices in the array are later in time
- # DEBUG
- puts "=============== GROUPING ================="
- # END DEBUG
-
related_objects = []
array_ids_to_delete = []
grouping_happened = false
@@ -1758,42 +1754,14 @@
i = events_unique.length - 2 # one before the last one
while (i >= 0) do
- # DEBUG
- puts "\ni = #{i}"
- # END DEBUG
-
-
# initialization for new loop iteration
new_event = events_unique[i]
reset_required = true
-
- # DEBUG
- if (new_event.created_at - base_event.created_at <= EVENT_GROUPING_TIMEFRAME)
- puts "timeframe match: seq_start(#{seq_start_idx}) -> current(#{i})"
- puts "new: " + new_event.action + " base: " + base_event.action + " #{ new_event.action == base_event.action}"
- puts "new: " + new_event.activity_loggable_type + " base: " + base_event.activity_loggable_type + " #{ new_event.activity_loggable_type == base_event.activity_loggable_type}"
- puts "new: " + new_event.culprit_type + " base: " + base_event.culprit_type + " #{ new_event.culprit_type == base_event.culprit_type}" unless new_event.culprit_type.nil? || base_event.culprit_type.nil?
- puts "new: #{new_event.culprit_id} base: #{base_event.culprit_id} #{new_event.culprit_id == base_event.culprit_id}" unless new_event.culprit_id.nil? || base_event.culprit_id.nil?
- puts "new: " + new_event.referenced_type + " base: " + base_event.referenced_type + " #{ new_event.referenced_type == base_event.referenced_type}" unless new_event.referenced_type.nil? || base_event.referenced_type.nil?
- puts "new: #{new_event.referenced_id} base: #{base_event.referenced_id} #{new_event.referenced_id == base_event.referenced_id}" unless new_event.referenced_id.nil? || base_event.referenced_id.nil?
-
- puts "-- first condition of further check: #{["Tagging"].include? new_event.activity_loggable_type}"
- puts "-- second condition of further check: #{new_event.action == "create"}"
- puts "\n"
- end
- # END DEBUG
-
-
# check if grouping will happen
grouping_allowed, related_object = group_event_with_base?(new_event, base_event)
if grouping_allowed
- # events are within the correct timeframe and potentially can be grouped
-
- # DEBUG
- puts "grouping should happen"
- # END DEBUG
-
+ # events are within the correct timeframe and are found to be allowed for grouping
seq_timestamp = [new_event.created_at, new_event.updated_at]
related_objects << related_object
array_ids_to_delete << i
@@ -1806,10 +1774,6 @@
# current sequence has ended (or never started) - current element is "different" enough, so starts the new sequence
# (no processing for current element is required at this iteration - only finalizing actions with the old sequence)
if grouping_happened
- # DEBUG
- puts "groping happened, seq finished"
- # END DEBUG
-
events_unique[seq_start_idx].created_at = seq_timestamp[0]
events_unique[seq_start_idx].updated_at = seq_timestamp[1]
events_unique[seq_start_idx] = [events_unique[seq_start_idx], related_objects]
@@ -1833,11 +1797,6 @@
if grouping_happened
# the zeroth element in array (last one in the loop) got grouped
-
- # DEBUG
- puts "groping happened at last element, seq finished"
- # END DEBUG
-
events_unique[seq_start_idx].created_at = seq_timestamp[0]
events_unique[seq_start_idx].updated_at = seq_timestamp[1]
events_unique[seq_start_idx] = [events_unique[seq_start_idx], related_objects]