original_docstring: 
          Update rank according to new relevance
          
docstring: Update rank according to new relevance
docstring_tokens: Update rank according to new relevance
code: def __update_rank(user, item, record):
          """
          Update rank according to new relevance
          """
          recipient, sender, entity = None, None, None
          action = RankHelper.get_action_by_name('click_relevant')\
                    if record.is_relevant\
                    else RankHelper.get_action_by_name('click_irrelevant')
  
          # Get rank data according to item type
          if item.item_type == TypesHelper.encode('tutorial'):
              try:
                  recipient = AccountProfile.objects.get(
                      user_id=TutorialProcessHelper.author(item.item_id)
                  )
              except AccountProfile.DoesNotExist:
                  pass
          elif item.item_type == TypesHelper.encode('comment'):
              try:
                  recipient = CommentActive.objects.get(id=item.item_id).author.profile
              except CommentActive.DoesNotExist:
                  pass
  
          sender = user.profile
          entity = [item.item_id, TypesHelper.reverse(item.item_type)]
  
          if recipient and sender and entity:
              # Cancel the record and update experience
              if not record or not record.is_relevant:
                  RankProcessHelper.cancel(
                      recipient,
                      sender,
                      entity,
                      action,
                  )
              else:
                  # Create the record and update experience
                  RankProcessHelper.create(
                      recipient,
                      sender,
                      entity,
                      action,
                  )
code_tokens: def __update_rank ( user , item , record ) : recipient , sender , entity = None , None , None action = RankHelper . get_action_by_name ( 'click_relevant' ) if record . is_relevant else RankHelper . get_action_by_name ( 'click_irrelevant' ) if item . item_type == TypesHelper . encode ( 'tutorial' ) : try : recipient = AccountProfile . objects . get ( user_id = TutorialProcessHelper . author ( item . item_id ) ) except AccountProfile . DoesNotExist : pass elif item . item_type == TypesHelper . encode ( 'comment' ) : try : recipient = CommentActive . objects . get ( id = item . item_id ) . author . profile except CommentActive . DoesNotExist : pass sender = user . profile entity = [ item . item_id , TypesHelper . reverse ( item . item_type ) ] if recipient and sender and entity : if not record or not record . is_relevant : RankProcessHelper . cancel ( recipient , sender , entity , action , ) else : RankProcessHelper . create ( recipient , sender , entity , action , )
short_docstring: Update rank according to new relevance
short_docstring_tokens: Update rank according to new relevance
comment: """
          Update rank according to new relevance
          """$SEP$# Get rank data according to item type$SEP$# Cancel the record and update experience$SEP$# Create the record and update experience