示例#1
0
    def _set_reported_results(self):
        self._results = []

        self._results.append(
            election.Result(self._contestants[0],
                            self.num_approve / self.total_ballots,
                            self.num_approve))
        self._results.append(
            election.Result(self._contestants[1],
                            self.num_reject / self.total_ballots,
                            self.num_reject))

        self._election.set_reported_results(self._results)
示例#2
0
def make_result(all_contestants, result_dict):
    # TODO: we construct these candidates here. Make sure there are
    #   no issues with pointer equality from creating them twice:
    contestant = all_contestants[result_dict['candidate']]
    return WAVEelection.Result(contestant=contestant,
                               percentage=result_dict['proportion'],
                               votes=result_dict['votes'])
示例#3
0
    def get_current_result(self):
        count = 0

        for result in self._cached_results:
            count += result[1]

        audit_results = []

        for person in self._cached_results:
            result = election.Result(person[0], person[1] / count)
            audit_results.append(result)
示例#4
0
    def _set_reported_results(self):
        self._results = []

        self._results.append(election.Result(self._contestants[0], .544))
        self._results.append(election.Result(self._contestants[1], 0.389))
        self._results.append(election.Result(self._contestants[2], 0.032))
        self._results.append(election.Result(self._contestants[3], 0.02))
        self._results.append(election.Result(self._contestants[4], 0.013))
        self._results.append(election.Result(self._contestants[5], 0.001))

        self._election.set_reported_results(self._results)