Changes after code review, used orm to calc SLA

Ok, 
to reduce query (min value of response_state) we can replace *.annotate(gr=Count('created')) by *.annotate(response_state=Min('response_state')) and remove from values() 'response_state'

full query:
<pre><code>service_history = ServiceHistory.objects.values('created').\
        filter(service_id=service.id).\
        filter(created__gt=local_start_time).\
        filter(created__lt=local_stop_time).\
        filter(response_state__lt=5).\
        annotate(response_state=Min('response_state')).\
        order_by('created', 'response_state')</code></pre>

Another questions is: How often `calculatesla` is triggered by Cron and how long it takes?