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()
示例#3
0
    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()
示例#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()
示例#5
0
文件: decision.py 项目: whausen/part
    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)
示例#6
0
文件: decision.py 项目: alkadis/vcv
    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)
示例#7
0
文件: __init__.py 项目: whausen/part
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))
示例#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)
示例#9
0
 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)
示例#10
0
文件: test_poll.py 项目: alkadis/vcv
 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())
示例#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)
示例#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))
示例#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())