
from datetime import datetime, timedelta

import api


def main():
    with api.create_app().app_context():
        settings = api.config.get_settings()
        settings["start_time"] = datetime.now()
        settings["end_time"] = settings["start_time"] + timedelta(weeks=52)
        api.config.change_settings(settings)


if __name__ == "__main__":
    main()


from datetime import datetime, timedelta

import api


def main():
    with api.create_app().app_context():
        api.events.add_event("Global", eligibility_conditions={})

        settings = api.config.get_settings()
        settings["start_time"] = datetime.now()
        settings["end_time"] = settings["start_time"] + timedelta(weeks=52)
        api.config.change_settings(settings)


if __name__ == "__main__":
    main()

Add a default Global event
Add a default Global event

  
  from datetime import datetime, timedelta
  
  import api
  
  
  def main():
      with api.create_app().app_context():
+         api.events.add_event("Global", eligibility_conditions={})
+ 
          settings = api.config.get_settings()
          settings["start_time"] = datetime.now()
          settings["end_time"] = settings["start_time"] + timedelta(weeks=52)
          api.config.change_settings(settings)
  
  
  if __name__ == "__main__":
      main()
  
Add a default Global event
## Code Before:

from datetime import datetime, timedelta

import api


def main():
    with api.create_app().app_context():
        settings = api.config.get_settings()
        settings["start_time"] = datetime.now()
        settings["end_time"] = settings["start_time"] + timedelta(weeks=52)
        api.config.change_settings(settings)


if __name__ == "__main__":
    main()

## Instruction:
Add a default Global event
## Code After:

from datetime import datetime, timedelta

import api


def main():
    with api.create_app().app_context():
        api.events.add_event("Global", eligibility_conditions={})

        settings = api.config.get_settings()
        settings["start_time"] = datetime.now()
        settings["end_time"] = settings["start_time"] + timedelta(weeks=52)
        api.config.change_settings(settings)


if __name__ == "__main__":
    main()
