hw_todo/tests/SpyRoutes.py
def complete(id):
    """
    (GET)
    Updates the completed field of the given assignment to either True or False
    """

    existing_tasks = db_canvas["Tasks"]
    task_to_complete = {}
    for x in range(len(db_canvas["Tasks"])):
        if existing_tasks[x]["Canvas ID"] == id:
            task_to_complete = existing_tasks[x]

    if task_to_complete == {}:
        print("HIT")
        return {"ERROR": "ID Not Found"}

    try:
        task_to_complete["Completed"] = not task_to_complete["Completed"]
        # database.session.commit()
        return db_canvas, 200
    except Exception as e:
        print(e)
        return 'There was a problem completing that task'

    (GET)
    Updates the completed field of the given assignment to either True or False
    
(GET)
Updates the completed field of the given assignment to either True or False
( GET ) Updates the completed field of the given assignment to either True or False
def complete(id):
    existing_tasks = db_canvas["Tasks"]
    task_to_complete = {}
    for x in range(len(db_canvas["Tasks"])):
        if existing_tasks[x]["Canvas ID"] == id:
            task_to_complete = existing_tasks[x]
    if task_to_complete == {}:
        print("HIT")
        return {"ERROR": "ID Not Found"}
    try:
        task_to_complete["Completed"] = not task_to_complete["Completed"]
        return db_canvas, 200
    except Exception as e:
        print(e)
        return 'There was a problem completing that task'
def complete ( id ) : existing_tasks = db_canvas [ "Tasks" ] task_to_complete = { } for x in range ( len ( db_canvas [ "Tasks" ] ) ) : if existing_tasks [ x ] [ "Canvas ID" ] == id : task_to_complete = existing_tasks [ x ] if task_to_complete == { } : print ( "HIT" ) return { "ERROR" : "ID Not Found" } try : task_to_complete [ "Completed" ] = not task_to_complete [ "Completed" ] return db_canvas , 200 except Exception as e : print ( e ) return 'There was a problem completing that task'
(GET)
Updates the completed field of the given assignment to either True or False
( GET ) Updates the completed field of the given assignment to either True or False
"""
    (GET)
    Updates the completed field of the given assignment to either True or False
    """ # database.session.commit()
id