#NEWLINE# @ get ( '/s/next' ) #NEWLINE# def next_route( request ) : #NEWLINE# #INDENT# '\n    Tell the learner where to go next.\n    TODO-3 should we move all `next` data from individual endpoints\n           to this one, and have the UI call this endpoint each time\n           to get the next state?\n    ' #NEWLINE# current_user = get_current_user ( request ) #NEWLINE# if ( not current_user ) : #NEWLINE# #INDENT# return abort ( 401 ) #NEWLINE# #UNINDENT# context = current_user . get_learning_context ( ) #NEWLINE# if context . get ( 'next' ) : #NEWLINE# #INDENT# return ( 200 , { #NEWLINE# #INDENT# 'next' : context [ 'next' ] , #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# return ( 200 , { #NEWLINE# #INDENT# 'next' : { #NEWLINE# #INDENT# 'method' : 'GET' , #NEWLINE# 'path' : '/s/users/{user_id}/sets' . format ( user_id = context [ 'id' ] ) , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } )