Indicates whether the document has a vote from particular voter object.

 @param [Mongoid::Document] voted_by object from which the vote was done
 @return [Boolean]
1407
def voted_by?(voted_by)
      !!votes.find_by(voted_by_id: voted_by.id)
    rescue NoMethodError, Mongoid::Errors::DocumentNotFound
      false
    end
693843
def get_election_votes(self, election):
        """"""
        candidate_election = CandidateElection.objects.get(
            candidate=self, election=election
        )

        return candidate_election.votes.all()
543338
def vote(self, voter, author, permlink, voteweight):
        ''' 
        '''
        vote = Vote(voter, author, permlink, voteweight)
        result = self.steemconnect().broadcast(
            [vote.to_operation_structure()])
        return result
908020
protected function hasUserVoted($vote) {
        $dql = "SELECT count(v.id) FROM CsnCms\Entity\Vote v LEFT JOIN v.usersVoted u WHERE v.id = ?0 AND u.id =?1";
        $query = $this->entityManager->createQuery($dql);

        $voteId = $vote->getId();

        $user = $this->getView()->identity();
        $hasUserVoted = -1;

        if ($voteId != null && $user != null) {
            $userId = $user->getId();
            $query->setParameter(0, $voteId);
            $query->setParameter(1, $userId);
            $hasUserVoted = $query->getSingleScalarResult();
        }

        return $hasUserVoted;
    }
199615
def document
      if !@document
        @document = Nokogiri::HTML(self.class.request_sncf(number, date))
        if !itinerary_available?
          @document = Nokogiri::HTML(self.class.request_sncf_itinerary(0))
        end
      end
      if @document.at('#no_results')
        fail TrainNotFound, @document.at('#no_results b').inner_html
      end
      @document
    end
662578
def upvote(self):
        
        data = self.get_selected_item()
        if 'likes' not in data:
            self.term.flash()
        elif getattr(data['object'], 'archived'):
            self.term.show_notification("Voting disabled for archived post", style='Error')
        elif data['likes']:
            with self.term.loader('Clearing vote'):
                data['object'].clear_vote()
            if not self.term.loader.exception:
                data['likes'] = None
        else:
            with self.term.loader('Voting'):
                data['object'].upvote()
            if not self.term.loader.exception:
                data['likes'] = True
757719
def get_election_electoral_votes(self, election):
        """"""
        candidate_election = CandidateElection.objects.get(
            candidate=self, election=election
        )

        return candidate_election.electoral_votes.all()
295385
def is_valid(self) -> bool:
        ''''''

        if not (self.blocknum >= self.vote.start_block and
                self.blocknum <= self.vote.end_block):
            return False

        if not self.confirmations >= 6:
            return False

        return True
726396
def vote_witness(self, witness, account=None):
        ''' 
        '''
        if not account:
            account = self.mainaccount
        try:
            self.steem_instance().approve_witness(witness, account=account)
        except Exception as e:
            self.msg.error_message("COULD NOT VOTE " 
                                    + witness + " AS WITNESS: " + e)
            return False
        else:
            return True
424937
def vote_total(self):
        
        modelbase_obj = self.modelbase_obj
        return modelbase_obj.votes.filter(vote=+1).count() - modelbase_obj.votes.filter(vote=-1).count()
49321
def unvote!(voteable)
      begin
        unvote(voteable)
        success = true
      rescue Exceptions::NotVotedError
        success = false
      end
      success
    end
685436
def vote_history(self, permlink, author=None):
        ''' 
        '''
        if author is None:
            author = self.mainaccount
        return self.steem_instance().get_active_votes(author, permlink)
481900
def vote
      @translation = Translation.find(params[:translation_id])
      current_user.likes(@translation)
      respond_to do |format|
        format.js
      end
    end
905316
def up_vote!(voteable)
      begin
        up_vote(voteable)
        success = true
      rescue Exceptions::AlreadyVotedError
        success = false
      end
      success
    end
668511
def has_item(self, url):
        

        _hash = self.build_hash(url)
        query = {'_id': _hash}
        doc = self.dbase.cache.find_one(query, {'id': 1})
        return doc is not None
859433
def up_vote(voteable)
      check_voteable(voteable)

      voting = fetch_voting(voteable)

      if voting
        if voting.up_vote
          raise Exceptions::AlreadyVotedError.new(true)
        else
          voting.up_vote = true
          voteable.down_votes -= 1
          self.down_votes -= 1 if has_attribute?(:down_votes)
        end
      else
        voting = Voting.create(:voteable => voteable, :voter_id => self.id, :voter_type => self.class.to_s, :up_vote => true)
      end

      voteable.up_votes += 1
      self.up_votes += 1 if has_attribute?(:up_votes)

      Voting.transaction do
        save
        voteable.save
        voting.save
      end

      true
    end
856745
def has_been_completed_by(poll, user):
    
    user_votes = TopicPollVote.objects.filter(
        poll_option__poll=poll)
    if user.is_anonymous:
        forum_key = get_anonymous_user_forum_key(user)
        user_votes = user_votes.filter(anonymous_key=forum_key) if forum_key \
            else user_votes.none()
    else:
        user_votes = user_votes.filter(voter=user)
    return user_votes.exists()