Beispiel #1
0
 def get_total_metrics_from_org_id(self, id):
     org = self.get_organzation_by_id(id)
     analytics = Analytics()
     with DB.cursor() as cursor:
         query = "SELECT SUM(donation_amount) as total_raised, COUNT(*) as number_of_donations, COUNT(DISTINCT user_id) as number_of_pledges     FROM pledge_submissions WHERE organization_id = %s"
         print(query)
         cursor.execute(query, (org.id))
         result = cursor.fetchone()
         DB.commit()
         analytics.set_progress(result)
         analytics.set_goals(org)
     return analytics