#NEWLINE# def get_recent_locations( self , max_results = 10 ) : #NEWLINE# #INDENT# '\n        Returns the last n locations of a Person. If the person is participating\n        in a Trip as a Driver, it directly returns the last n locations stored\n        in the Participation, for having better results in research algorithms\n        ' #NEWLINE# if ( self . get_active_participation ( ) and ( self . get_active_participation ( ) . role == 'driver' ) ) : #NEWLINE# #INDENT# current_participation = self . get_active_participation ( ) #NEWLINE# recent_locations = list ( current_participation . locations . filter ( ) . only ( 'id' , 'georss_point' ) . order_by ( '-id' ) [ : max_results ] ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# recent_locations = list ( self . locations . filter ( ) . only ( 'id' , 'georss_point' ) . order_by ( '-id' ) [ : max_results ] ) #NEWLINE# #UNINDENT# recent_locations . reverse ( ) #NEWLINE# return recent_locations