def get_by_goal_name(cls, connection, goal_name, week, completed=None): """Get all activities with goal_name from 'activity_goal' table on <week> of all users :param connection: DB connection object :param goal_name: goal name :param week: week number :param completed: status of the activity (True/False/None) True - returns all the completed goal_name goals of all users False - return all the in-progress goal_name goals of all user None - return all the goals_name goals of all users :return: list of activities of all users with goal_name [{ 'user_id': <user-id>, 'goal_id': <goal-id>, 'frequency': <number-of-times-goal-performed> (3), 'last_updated': <datetime>, 'completed_on': {1: <datetime>, 2: <datetime>, 3: <datetime>}, 'completed': True (or) False }] """ goal_id = Goal.get_goal_id(connection, goal_name, week) return cls.get_by_goal_id(connection, goal_id, completed=completed)