Ejemplo n.º 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
Ejemplo n.º 2
0
 def test_not_receieved_progress_report(self):
     """
     Test that not received progress report returns correct figures
     """
     report = progress.NotRecievedProgressReport(self.tally.id)
     self.assertEqual(report.number, 1)
     self.assertEqual(report.total, 10)
     self.assertEqual(report.percentage, 10)
Ejemplo n.º 3
0
def getOverviews(tally_id):
    overviews = [
            p.ExpectedProgressReport(tally_id),
            p.IntakeProgressReport(tally_id),
            p.DataEntry1ProgressReport(tally_id),
            p.DataEntry2ProgressReport(tally_id),
            p.CorrectionProgressReport(tally_id),
            p.QualityControlProgressReport(tally_id),
            p.ArchivedProgressReport(tally_id),
            p.ClearanceProgressReport(tally_id),
            p.AuditProgressReport(tally_id),
            p.NotRecievedProgressReport(tally_id)
    ]

    return overviews
Ejemplo n.º 4
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
Ejemplo n.º 5
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()))
Ejemplo n.º 6
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
Ejemplo n.º 7
0
 def test_not_receieved_progress_report(self):
     report = progress.NotRecievedProgressReport()
     self.assertEqual(report.number, 2)
     self.assertEqual(report.total, 11)
     self.assertEqual(report.percentage, 18.181818181818183)