def handle(self, *args, **options):
        """Calculate the energy baseline data for all teams"""
        if not options["weeks"]:
            print "Please specify the number of weeks of baseline data."
            sys.exit(2)

        weeks = int(options["weeks"])

        today = datetime.datetime.today()
        print '****** Processing update_dynamic_energy_baseline for %s *******\n' % today

        resource_goal.update_energy_baseline(today.date(), weeks, "Dynamic")
    def handle(self, *args, **options):
        """check the energy goal for all teams"""
        today = datetime.datetime.today()

        print '****** Processing check_energy_goal for %s *******\n' % today

        # update the latest resource usage before checking
        resource_mgr.update_energy_usage()

        resource_goal.check_all_daily_resource_goals("energy")

        # update the dynamic baseline if they are dynamic
        resource_goal.update_energy_baseline(today.date(), 2, "Dynamic")
    def handle(self, *args, **options):
        """Calculate the energy baseline data for all teams"""
        if not options["end_date"]:
            print "Please specify the end_date of the baseline data."
            sys.exit(2)

        if not options["weeks"]:
            print "Please specify the number of weeks of previous baseline data."
            sys.exit(2)

        end_date = datetime.datetime.strptime(options["end_date"], "%Y-%m-%d").date()
        weeks = int(options["weeks"])

        resource_goal.update_energy_baseline(end_date, weeks, "Fixed")