Permalink
Browse files

OPTIMIZING QUERIES FTW.

  • Loading branch information...
1 parent 9a77c62 commit 50b8f158553e622e2a86d576b61b23226be237ba @ctbarna ctbarna committed Jul 14, 2011
Showing with 6 additions and 5 deletions.
  1. +6 −5 dashboard/views.py
View
@@ -16,6 +16,9 @@
import qsstats
import time
+# PROFILING
+from django.db import connection
+
def index(request):
return render(request, 'index.html')
@@ -70,22 +73,20 @@ def ticket_days(request, ticket_status="open", start=None, end=None,
data = []
try:
- raw_data = stats.time_series(start, end, engine='postgres')
+ raw_data = stats.time_series(start, end)
for row in raw_data:
temp_data = {'date': int(time.mktime(row[0].timetuple())), 'count': row[1]}
data.append(temp_data)
except:
- opened_data = stats_opened.time_series(start, end, engine='postgres')
- closed_data = stats_closed.time_series(start, end, engine='postgres')
-
+ opened_data = stats_opened.time_series(start, end)
+ closed_data = stats_closed.time_series(start, end)
for i in range(len(opened_data)):
temp_data = {'date': int(time.mktime(opened_data[i][0].timetuple())),
'open_count': opened_data[i][1],
'closed_count': closed_data[i][1],
}
data.append(temp_data)
-
return data
# Get service_name stats for a range of dates

0 comments on commit 50b8f15

Please sign in to comment.