Bug fix for last minute features.

Change-Id: Ie04d4756d41b37902ef30d161f1f0ac9436ac2b3
Reviewed-on: https://gerrit.instructure.com/2094
Reviewed-by: Zach Wily <zach@instructure.com>
Tested-by: Zach Wily <zach@instructure.com>
This commit is contained in:
JT Olds 2011-02-01 10:09:35 -07:00
parent 71dbe1f968
commit c1f180bf7e
1 changed files with 4 additions and 2 deletions

View File

@ -69,12 +69,14 @@ class CountsReport
each_account do |a|
next if a.external_status == 'test'
activity = last_activity(a.id)
next unless activity
account = {}
account[:id] = a.id
account[:name] = a.name
account[:external_status] = a.external_status
account[:last_activity] = last_activity(a.id)
account[:last_activity] = activity
account[:page_views_in_last_week] = get_count_from_query(PAGE_VIEWS_FOR_ACCOUNT % [a.id, (@yesterday - 1.week).to_s(:db), @yesterday.to_s(:db)])
account[:page_views_in_last_month] = get_count_from_query(PAGE_VIEWS_FOR_ACCOUNT % [a.id, (@yesterday - 1.month).to_s(:db), @yesterday.to_s(:db)])
@ -221,7 +223,7 @@ class CountsReport
def last_activity(account_id)
query = "SELECT max(created_at) FROM `#{PageView.table_name}` WHERE account_id = #{account_id}"
res = ActiveRecord::Base.connection.execute(query)
res.fetch_row[0]
res.fetch_row[0] rescue nil
end
def get_course_ids(account, course_ids)