def setUp(self):
     self.me = tt_make_user()
     self.first = tt_make_user()
     self.second = tt_make_user()
     self.proposal = tt_make_proposal(voting=True)
     self.poll = Poll.create(self.proposal, self.proposal.creator,
                             Poll.ADOPT)
     self.instance = tt_get_instance()
 def setUp(self):
     self.me = tt_make_user()
     self.first = tt_make_user()
     self.second = tt_make_user()
     self.proposal = tt_make_proposal(voting=True)
     self.poll = Poll.create(self.proposal, self.proposal.creator,
                             Poll.ADOPT)
     self.instance = tt_get_instance()
    def setUp(self):
        self.me = tt_make_user(name='me')
        self.high_delegate = tt_make_user(name='high_delegate')
        self.low_delegate = tt_make_user(name='low_delegate')

        self.proposal = tt_make_proposal(creator=self.me, voting=True)
        self.poll = Poll.create(self.proposal, self.proposal.creator,
                                Poll.ADOPT)
        self.decision = Decision(self.me, self.poll)
        self.instance = tt_get_instance()
Beispiel #4
0
    def setUp(self):
        super(TestDecisionWithDelegation, self).setUp()
        self.me = tt_make_user(name='me')
        self.high_delegate = tt_make_user(name='high_delegate')
        self.low_delegate = tt_make_user(name='low_delegate')

        self.proposal = tt_make_proposal(creator=self.me, voting=True)
        self.poll = Poll.create(self.proposal, self.proposal.creator,
                                Poll.ADOPT)
        self.decision = Decision(self.me, self.poll)
        self.instance = tt_get_instance()
Beispiel #5
0
    def replay_decisions(cls, delegation):
        """
        For a new delegation, have the principal reproduce all of the
        agents past decisions within the delegation scope.
        This process is not perfect, since not the full voting history
        is reproduced, but only the latest interim result. The resulting
        decisions should be the same, though.

        :param delegation: The delegation that is newly created.
        """
        for poll in Poll.within_scope(delegation.scope):
            agent_decision = Decision(delegation.agent, poll)
            if agent_decision.is_decided():
                principal_decision = Decision(delegation.principal, poll)
                principal_decision.make(agent_decision.result,
                                        _edge=delegation)
                log.debug("RP: Making %s" % principal_decision)
Beispiel #6
0
    def replay_decisions(cls, delegation):
        """
        For a new delegation, have the principal reproduce all of the
        agents past decisions within the delegation scope.
        This process is not perfect, since not the full voting history
        is reproduced, but only the latest interim result. The resulting
        decisions should be the same, though.

        :param delegation: The delegation that is newly created.
        """
        for poll in Poll.within_scope(delegation.scope):
            agent_decision = Decision(delegation.agent, poll)
            if agent_decision.is_decided():
                principal_decision = Decision(delegation.principal, poll)
                principal_decision.make(agent_decision.result,
                                        _edge=delegation)
                log.debug("RP: Making %s" % principal_decision)
Beispiel #7
0
def update_delegation(delegation):
    for poll in Poll.within_scope(delegation.scope):
        tally = Tally.create_from_poll(poll)
        meta.Session.commit()
        log.debug("Tallied %s: %s" % (poll, tally))
Beispiel #8
0
 def setUp(self):
     super(TestDecisionWithoutDelegation, self).setUp()
     self.proposal = tt_make_proposal(voting=True)
     self.poll = Poll.create(self.proposal, self.proposal.creator,
                             Poll.ADOPT)
     self.decision = Decision(self.proposal.creator, self.poll)
 def setUp(self):
     self.proposal = tt_make_proposal(voting=True)
     self.poll = Poll.create(self.proposal, self.proposal.creator,
                             Poll.ADOPT)
     self.decision = Decision(self.proposal.creator, self.poll)
Beispiel #10
0
 def test_begin_end(self):
     proposal = tt_make_proposal(voting=False)
     poll = Poll.create(proposal, proposal.creator, Poll.ADOPT)
     poll.end()
     self.assertTrue(poll.has_ended())
Beispiel #11
0
 def setUp(self):
     super(TestDecisionWithoutDelegation, self).setUp()
     self.proposal = tt_make_proposal(voting=True)
     self.poll = Poll.create(self.proposal, self.proposal.creator,
                             Poll.ADOPT)
     self.decision = Decision(self.proposal.creator, self.poll)
Beispiel #12
0
def update_delegation(delegation):
    for poll in Poll.within_scope(delegation.scope):
        tally = Tally.create_from_poll(poll)
        meta.Session.commit()
        log.debug("Tallied %s: %s" % (poll, tally))
Beispiel #13
0
 def test_begin_end(self):
     proposal = tt_make_proposal(voting=False)
     poll = Poll.create(proposal, proposal.creator, Poll.ADOPT)
     poll.end()
     self.assertTrue(poll.has_ended())