def get_avg_app_waiting_time():
 cursor = connection.cursor()
 cursor.execute('\n        SELECT AVG(DATEDIFF(reviewed, nomination)) FROM versions\n        RIGHT JOIN addons ON versions.addon_id = addons.id\n        WHERE status = %s AND reviewed >= DATE_SUB(NOW(), INTERVAL 30 DAY)\n    ', (mkt.STATUS_PUBLIC,))
 row = cursor.fetchone()
 days = 0
 if row:
  try:
   days = math.ceil(float(row[0]))
  except TypeError:
   pass
 return days

def get_avg_app_waiting_time ( ) : cursor = connection . cursor ( ) cursor . execute ( '\n        SELECT AVG(DATEDIFF(reviewed, nomination)) FROM versions\n        RIGHT JOIN addons ON versions.addon_id = addons.id\n        WHERE status = %s AND reviewed >= DATE_SUB(NOW(), INTERVAL 30 DAY)\n    ' , ( mkt . STATUS_PUBLIC , ) ) row = cursor . fetchone ( ) days = 0 if row : try : days = math . ceil ( float ( row [ 0 ] ) ) except TypeError : pass return days
returns the rolling average from the past 30 days of the time taken for a pending app to become public .