parameters: (uid, traits)
docstring: Add user story records for any new shared stories
          :param uid: integer
          :param traits: list of strings
          :return:
docstring_summary: Add user story records for any new shared stories
          :param uid: integer
          :param traits: list of strings
          :return:
docstring_tokens: Add user story records for any new shared stories : param uid : integer : param traits : list of strings : return :
function: def _add_shared_stories(uid, traits):
          """
          Add user story records for any new shared stories
          :param uid: integer
          :param traits: list of strings
          :return:
          """
          #todo: is there a quicker way to short circuit this, and avoid these queries, when it has recently been updated?
          # This current check will fail if the latest shared story excludes this user
          latest_id_for_user = UserStory.latest_shared_for_user(uid)
          latest_shared_id = SharedStory.latest_id()
          if latest_shared_id and (latest_shared_id != latest_id_for_user):
              query = {"_id": {"$gt": latest_id_for_user}} if latest_id_for_user is not None else None
              SharedStorySet.for_traits(traits, query=query, limit=10).register_for_user(uid)
function_tokens: def _add_shared_stories ( uid , traits ) : #todo: is there a quicker way to short circuit this, and avoid these queries, when it has recently been updated? # This current check will fail if the latest shared story excludes this user latest_id_for_user = UserStory . latest_shared_for_user ( uid ) latest_shared_id = SharedStory . latest_id ( ) if latest_shared_id and ( latest_shared_id != latest_id_for_user ) : query = { "_id" : { "$gt" : latest_id_for_user } } if latest_id_for_user is not None else None SharedStorySet . for_traits ( traits , query = query , limit = 10 ) . register_for_user ( uid )