def steps(self): toad_data = database.exec_sql(self.toad_query) check_in_data = database.exec_sql(self.check_in_query) adm_data = database.exec_sql(self.adm_query) piscine_data = database.exec_sql(self.piscine_query) data = [ dict(step="toad", count=toad_data[0]["count"]), dict(step="check-in", count=check_in_data[0]["count"]), dict(step="adm", count=adm_data[0]["count"]), dict(step="piscine", count=piscine_data[0]["count"]) ] return data
def step(self, step_name): step_dict = { "toad": 198, "check-in": 3293, "adm": 199, "piscine": 26 } return database.exec_sql(self.step_query % step_dict[step_name])
def daily(self, start: str, end: str): return database.exec_sql(self.per_day_query % (start, end))
def gender(self): gender_data = database.exec_sql(self.gender_query) return gender_data
def weekly(self): per_week_data = database.exec_sql(self.per_week_query) for i in range(len(per_week_data)): per_week_data[i]['last_day'] = datetime.strptime( per_week_data[i]['week'] + "-7", "%G-%V-%u") return per_week_data
def monthly(self): per_week_data = database.exec_sql(self.per_month_query) return per_week_data
def languages(self): languages_data = database.exec_sql(self.languages_query) return languages_data
def source_channels(self): source_channels_data = database.exec_sql(self.source_channels_query) return source_channels_data
def ages(self): ages_data = database.exec_sql(self.ages_query) return ages_data
def projects(self, project_type): data = database.exec_sql(self.project_query % project_type) return data