Example #1
0
    def get_per_office_progress(self):
        data = []
        tally_id = self.kwargs['tally_id']

        intaken = p.IntakenProgressReport(tally_id)
        not_intaken = p.NotRecievedProgressReport(tally_id)
        archived = p.ArchivedProgressReport(tally_id)
        valid_votes = p.ValidVotesProgressReport(tally_id)

        for office in Office.objects.filter(
                tally__id=tally_id).order_by('number'):
            intaken_results = intaken.for_center_office(office)
            not_intaken_results = not_intaken.for_center_office(office)
            archived_result = archived.for_center_office(office)
            total_valid_votes = valid_votes.for_center_office(
                office=office,
                query_valid_votes=True)
            office_candidates_id_array =\
                get_office_candidates_ids(
                    office_id=office.id, tally_id=tally_id)
            data.append({
                'office': office.name,
                'office_id': office.id,
                'number': office.number,
                'intaken': intaken_results,
                'not_intaken': not_intaken_results,
                'archived': archived_result,
                'valid_votes': total_valid_votes,
                'candidate_count': len(office_candidates_id_array)
            })

        return data
Example #2
0
 def test_intaken_progress_report(self):
     """
     Test that intaken progress report returns correct figures
     """
     report = progress.IntakenProgressReport(self.tally.id)
     self.assertEqual(report.number, 9)
     self.assertEqual(report.total, 10)
     self.assertEqual(report.percentage, 90.0)
Example #3
0
    def get_per_office_progress(self):
        data = []

        for office in Office.objects.all().order_by('number'):
            intaken = p.IntakenProgressReport().for_center_office(office)
            not_intaken = p.NotRecievedProgressReport().for_center_office(
                office)
            archived = p.ArchivedProgressReport().for_center_office(office)
            data.append({
                'office': office,
                'number': office.number,
                'intaken': intaken.number,
                'not_intaken': not_intaken.number,
                'archived': archived.number,
            })

        return data
Example #4
0
    def get(self, *args, **kwargs):
        overviews = [
            p.ExpectedProgressReport(),
            p.IntakenProgressReport(),
            p.DataEntry1ProgressReport(),
            p.DataEntry2ProgressReport(),
            p.CorrectionProgressReport(),
            p.QualityControlProgressReport(),
            p.ArchivingProgressReport(),
            p.ArchivedProgressReport(),
            p.ClearanceProgressReport(),
            p.AuditProgressReport(),
            p.NotRecievedProgressReport()
        ]

        return self.render_to_response(
            self.get_context_data(overviews=overviews,
                                  per_office=self.get_per_office_progress()))
Example #5
0
    def get_per_office_progress(self):
        data = []
        tally_id = self.kwargs['tally_id']

        intaken = p.IntakenProgressReport(tally_id)
        not_intaken = p.NotRecievedProgressReport(tally_id)
        archived = p.ArchivedProgressReport(tally_id)

        for office in Office.objects.filter(
                tally__id=tally_id).order_by('number'):
            intaken_results = intaken.for_center_office(office)
            not_intaken_results = not_intaken.for_center_office(office)
            archived_result = archived.for_center_office(office)
            data.append({
                'office': office.name,
                'number': office.number,
                'intaken': intaken_results,
                'not_intaken': not_intaken_results,
                'archived': archived_result,
            })

        return data
Example #6
0
 def test_intaken_progress_report(self):
     report = progress.IntakenProgressReport()
     self.assertEqual(report.number, 8)
     self.assertEqual(report.total, 11)
     self.assertEqual(report.percentage, 72.72727272727273)