rather than inner looping, just use a tmp ```first_activation = {}``` variable, something like:
```
if rollback_to = first_activation[deployment.id]
   item[:rollback] = true
   item[:rollback_to] = rollback_to
   items.each {|i| i[:rolled_back] = true if i[:activation].created_at.between?(rollback_to, activation.created_at) }
else
   first_activation[deployment.id] = activation.created_at
end
```