def guided_tour_finished():
 if (request.ajax == True):
  utable = s3db.tour_user
  person_id = auth.s3_logged_in_person()
  query = ((utable.person_id == person_id) & (utable.tour_config_id == request.post_vars.tour_id))
  db(query).update(resume='', completed=True, trip_counter=(utable.trip_counter + 1))
  return json.dumps({})
 else:
  redirect(URL(f='config'))

def guided_tour_finished ( ) : if ( request . ajax == True ) : utable = s3db . tour_user person_id = auth . s3_logged_in_person ( ) query = ( ( utable . person_id == person_id ) & ( utable . tour_config_id == request . post_vars . tour_id ) ) db ( query ) . update ( resume = '' , completed = True , trip_counter = ( utable . trip_counter + 1 ) ) return json . dumps ( { } ) else : redirect ( URL ( f = 'config' ) )
update database when tour completed otherwise redirect to tour/config .