Exemplo n.º 1
0
 def is_overriden_by_own_decision(delegation):
     if not hasattr(delegation.scope, 'poll'):
         return True  # scope doesn't have polls -> can't self decide
     if delegation.scope.poll is None:
         # currently no poll in this cope -> can't self decide
         return True
     decision = Decision(delegation.principal, delegation.scope.poll)
     return not decision.is_self_decided()
Exemplo n.º 2
0
 def is_overriden_by_own_decision(delegation):
     if not hasattr(delegation.scope, 'poll'):
         return True  # scope doesn't have polls -> can't self decide
     if delegation.scope.poll is None:
         return True  # currently no poll in this cope -> can't
         # self decide
     decision = Decision(delegation.principal, delegation.scope.poll)
     return not decision.is_self_decided()
Exemplo n.º 3
0
 def any_position_on_proposal(self, proposal):
     # this is fuzzy since it includes two types of opinions
     from adhocracy.lib.democracy.decision import Decision
     if proposal.adopt_poll:
         dec = Decision(self, proposal.adopt_poll)
         if dec.is_decided():
             return dec.result
     if proposal.rate_poll:
         return Decision(self, proposal.rate_poll).result
Exemplo n.º 4
0
 def any_position_on_proposal(self, proposal):
     # this is fuzzy since it includes two types of opinions
     from adhocracy.lib.democracy.decision import Decision
     if proposal.adopt_poll:
         dec = Decision(self, proposal.adopt_poll)
         if dec.is_decided():
             return dec.result
     if proposal.rate_poll:
         return Decision(self, proposal.rate_poll).result
Exemplo n.º 5
0
def voters(poll, at_time=None, orientation=None):
    query = meta.Session.query(User)
    query = query.distinct().join(Vote)
    query = query.filter(Vote.poll_id == poll.id)
    if at_time:
        query = query.filter(Vote.create_time <= at_time)

    if orientation is None:
        return query.all()
    else:
        voters = []
        for user in query:
            d = Decision(user, poll, at_time=at_time)
            if d.result == orientation:
                voters.append(user)
        return voters
Exemplo n.º 6
0
 def position_on_poll(self, poll):
     from adhocracy.lib.democracy.decision import Decision
     return Decision(self, poll).result