def __init__(self): self._all_votes = SFXVote.db().all() self._all_users = User.db().all() self._all_cmds = Command.db().all() # self._user_code = UserCode.db().all() self._all_sfxs = SoundeffectsLibrary.fetch_soundeffect_samples() self.command_users = self._setup_command_users()
def purge_duplicate_users(): found_users = [] to_delete = [] for user in User.db().all(): if user["name"] not in found_users: found_users.append(user["name"]) else: print(f"TO DELETE: {user['name']}") to_delete.append(user.doc_id) print(f"IDS TO DELETE: {to_delete}")
def stats(self): all_users = User.db().all() all_cmds = Command.db().all() total_cool_points = sum([user["cool_points"] for user in all_users]) total_street_cred = sum([user["street_cred"] for user in all_users]) fed_reserve = TheFed.reserve() total_user_sfx_property = sum([ cmd["cost"] * len(cmd["permitted_users"]) for cmd in all_cmds if len(cmd["permitted_users"]) > 0 ]) return { "total_street_cred": total_street_cred, "total_cool_points": total_cool_points, "fed_reserve": fed_reserve, "total_user_sfx_property": total_user_sfx_property, }