hw_todo/tests/SpyRoutes.py
def update(id):
    """
    (POST)
    Updates any field of the given assignment
    """
    existing_tasks = db_canvas["Tasks"]
    task_to_update = {}
    for x in range(len(db_canvas["Tasks"])):
        if existing_tasks[x]["Canvas ID"] == id:
            task_to_update = existing_tasks[x]

    if task_to_update == {}:
        return {"ERROR": "ID Not Found"}

    try:
        task_to_update["Assignment"] = request.form['assignment']
        task_to_update["Due Date"] = datetime.strptime(request.form['due_date'], '%Y-%m-%dT%H:%M')
        task_to_update["Course"] = request.form['course']
    except Exception as e:
        print(e)
        return {"ERROR": "MISSING INFORMATION"}

    try:
        # database.session.commit()
        return db_canvas
    except Exception as e:
        print(e)
        return 'There was an issue updating your task'

    (POST)
    Updates any field of the given assignment
    
(POST)
Updates any field of the given assignment
( POST ) Updates any field of the given assignment
def update(id):
    existing_tasks = db_canvas["Tasks"]
    task_to_update = {}
    for x in range(len(db_canvas["Tasks"])):
        if existing_tasks[x]["Canvas ID"] == id:
            task_to_update = existing_tasks[x]
    if task_to_update == {}:
        return {"ERROR": "ID Not Found"}
    try:
        task_to_update["Assignment"] = request.form['assignment']
        task_to_update["Due Date"] = datetime.strptime(request.form['due_date'], '%Y-%m-%dT%H:%M')
        task_to_update["Course"] = request.form['course']
    except Exception as e:
        print(e)
        return {"ERROR": "MISSING INFORMATION"}
    try:
        return db_canvas
    except Exception as e:
        print(e)
        return 'There was an issue updating your task'
def update ( id ) : existing_tasks = db_canvas [ "Tasks" ] task_to_update = { } for x in range ( len ( db_canvas [ "Tasks" ] ) ) : if existing_tasks [ x ] [ "Canvas ID" ] == id : task_to_update = existing_tasks [ x ] if task_to_update == { } : return { "ERROR" : "ID Not Found" } try : task_to_update [ "Assignment" ] = request . form [ 'assignment' ] task_to_update [ "Due Date" ] = datetime . strptime ( request . form [ 'due_date' ] , '%Y-%m-%dT%H:%M' ) task_to_update [ "Course" ] = request . form [ 'course' ] except Exception as e : print ( e ) return { "ERROR" : "MISSING INFORMATION" } try : return db_canvas except Exception as e : print ( e ) return 'There was an issue updating your task'
(POST)
Updates any field of the given assignment
( POST ) Updates any field of the given assignment
"""
    (POST)
    Updates any field of the given assignment
    """ # database.session.commit()
id