<reponame>eisenhowerj/hubble<filename>updater/reports/ReportOrgsTotal.py<gh_stars>100-1000
from .ReportDaily import *

# Lists the total number of organizations
class ReportOrgsTotal(ReportDaily):
	def name(self):
		return "orgs-total"

	def updateDailyData(self):
		self.header, newData = self.parseData(self.executeQuery(self.query()))
		self.data.extend(newData)
		self.truncateData(self.timeRangeTotal())
		self.sortDataByDate()

	def query(self):
		return '''
			SELECT
				"''' + str(self.yesterday()) + '''" AS date,
				COUNT(*) AS total
			FROM
				users AS orgs
			WHERE
				orgs.type = "Organization"
				''' + self.andExcludedEntities("orgs.login")

from .ReportDaily import *

# Lists the total number of organizations
class ReportOrgsTotal(ReportDaily):
	def name(self):
		return "orgs-total"

	def updateDailyData(self):
		self.header, newData = self.parseData(self.executeQuery(self.query()))
		self.data.extend(newData)
		self.truncateData(self.timeRangeTotal())
		self.sortDataByDate()

	def query(self):
		return '''
			SELECT
				"''' + str(self.yesterday()) + '''" AS date,
				COUNT(*) AS total
			FROM
				users AS orgs
			WHERE
				orgs.type = "Organization"
				''' + self.andExcludedEntities("orgs.login")
# Lists the total number of organizations SELECT 				" " AS date, 				COUNT(*) AS total 			FROM 				users AS orgs 			WHERE 				orgs.type = "Organization"