def test_should_return_latest_reporting_date_for_record(self):
     smc = create_group('SMC')
     location = create_location('kampala', create_location_type('district'))
     emis_reporter = create_emis_reporters('reporter1',location,None,12345,smc)
     poll = create_poll_with_reporters('poll1','dummy question',Poll.TYPE_TEXT,create_user_with_group('user1'),[emis_reporter])
     responses1 = Response.objects.create(poll=poll,contact=emis_reporter)
     responses2 = Response.objects.create(poll=poll,contact=emis_reporter)
     responses3 = Response.objects.create(poll=poll,contact=emis_reporter)
     self.set_response_date(responses1,dateutils.increment(datetime.now(),weeks=-1))
     self.set_response_date(responses2,dateutils.increment(datetime.now(),weeks=-2))
     self.set_response_date(responses3,dateutils.increment(datetime.now(),weeks=-3))
     latest_date = latest(emis_reporter)
     self.assertEqual(dateutils.increment(datetime.now(),weeks=-1).date(),latest_date.date())
    def setUp(self):
        smc_group = create_group('SMC')
        admin_group = create_group('Admins')
        country = create_location_type("country")
        uganda_fields = {
            "rght": 15274,
            "level": 0,
            "tree_id": 1,
            "lft": 1,
            }
        self.uganda = create_location("uganda", country, **uganda_fields)
        district = create_location_type("district")
        kampala_fields = {
            "rght": 10901,
            "tree_parent": self.uganda,
            "level": 1,
            "tree_id": 1,
            "lft": 10686,
            }
        kampala_point = {
            "latitude": "0.3162800000",
            "longitude": "32.5821900000"
        }
        self.kampala_district = create_location("Kampala", district, point=kampala_point, **kampala_fields)

        self.kampala_school = create_school("St. Joseph's", self.kampala_district)
        self.head_teachers_group = create_group('Head Teachers')
        self.emis_reporter1 = create_emis_reporters("dummy1", self.kampala_district, self.kampala_school, 12345,
                                                    self.head_teachers_group)
        self.emis_reporter2 = create_emis_reporters("dummy2", self.kampala_district, self.kampala_school, 12346, self.head_teachers_group)
        self.emis_reporter3 = create_emis_reporters("dummy3", self.kampala_district, self.kampala_school, 12347, self.head_teachers_group)
        self.emis_reporter4 = create_emis_reporters("dummy4", self.kampala_district, self.kampala_school, 12348, smc_group)
        self.admin_user = create_user_with_group("John", admin_group, self.uganda)
        self.water_source_poll = create_poll_with_reporters('edtrac_water_source', "Does this school have a water source within 500 metres from the school? Answer yes or no",
                                               Poll.TYPE_TEXT, self.admin_user,
                                               [self.emis_reporter1, self.emis_reporter2, self.emis_reporter3,
                                                self.emis_reporter4])
        self.water_source_poll.add_yesno_categories()
        self.water_source_poll.save()
        today = datetime(datetime.now().year,datetime.now().month,datetime.now().day)
        settings.SCHOOL_TERM_START = dateutils.increment(today, weeks=-5)
        settings.SCHOOL_TERM_END = dateutils.increment(today,weeks=7)
        self.term_range = [settings.SCHOOL_TERM_START,settings.SCHOOL_TERM_END]
Exemple #3
0
 def test_should_return_latest_reporting_date_for_record(self):
     smc = create_group('SMC')
     location = create_location('kampala', create_location_type('district'))
     emis_reporter = create_emis_reporters('reporter1', location, None,
                                           12345, smc)
     poll = create_poll_with_reporters('poll1', 'dummy question',
                                       Poll.TYPE_TEXT,
                                       create_user_with_group('user1'),
                                       [emis_reporter])
     responses1 = Response.objects.create(poll=poll, contact=emis_reporter)
     responses2 = Response.objects.create(poll=poll, contact=emis_reporter)
     responses3 = Response.objects.create(poll=poll, contact=emis_reporter)
     self.set_response_date(responses1,
                            dateutils.increment(datetime.now(), weeks=-1))
     self.set_response_date(responses2,
                            dateutils.increment(datetime.now(), weeks=-2))
     self.set_response_date(responses3,
                            dateutils.increment(datetime.now(), weeks=-3))
     latest_date = latest(emis_reporter)
     self.assertEqual(
         dateutils.increment(datetime.now(), weeks=-1).date(),
         latest_date.date())
    def setUp(self):
        country = create_location_type("country")
        uganda_fields = {
            "rght": 15274,
            "level": 0,
            "tree_id": 1,
            "lft": 1,
        }
        self.uganda = create_location("uganda", country, **uganda_fields)
        admin_group = create_group("Admins")
        self.admin_user = create_user_with_group("John", admin_group,
                                                 self.uganda)

        district = create_location_type("district")
        kampala_fields = {
            "rght": 10901,
            "tree_parent": self.uganda,
            "level": 1,
            "tree_id": 1,
            "lft": 10686,
        }
        kampala_point = {
            "latitude": "0.3162800000",
            "longitude": "32.5821900000"
        }
        self.kampala_district = create_location("Kampala",
                                                district,
                                                point=kampala_point,
                                                **kampala_fields)
        self.kampala_school = create_school("St. Joseph's",
                                            self.kampala_district)
        self.head_teacher_group = create_group("Head Teachers")
        self.emis_reporter1 = create_emis_reporters("dummy1",
                                                    self.kampala_district,
                                                    self.kampala_school, 12345,
                                                    self.head_teacher_group)
        self.emis_reporter1.grade = 'P6'
        self.emis_reporter1.save()
        self.emis_reporter2 = create_emis_reporters("dummy2",
                                                    self.kampala_district,
                                                    self.kampala_school, 12346,
                                                    self.head_teacher_group)
        self.emis_reporter2.grade = 'P6'
        self.emis_reporter2.save()

        self.p6_boys_absent_poll = create_poll_with_reporters(
            "edtrac_boysp6_attendance",
            "How many P6 boys are at school today?", Poll.TYPE_NUMERIC,
            self.admin_user, [self.emis_reporter1, self.emis_reporter2])
        self.p6_girls_absent_poll = create_poll_with_reporters(
            "edtrac_girlsp6_attendance",
            "How many P6 girls are at school today?", Poll.TYPE_NUMERIC,
            self.admin_user, [self.emis_reporter1, self.emis_reporter2])

        self.teachers_weekly_script = Script.objects.create(
            name='Revised P6 Teachers Weekly Script',
            slug='edtrac_p6_teachers_weekly')
        self.p6_boys_attendance_step = ScriptStep.objects.create(
            script=self.teachers_weekly_script,
            poll=self.p6_boys_absent_poll,
            order=0,
            rule=ScriptStep.WAIT_MOVEON,
            start_offset=0,
            giveup_offset=7200)
        self.teachers_weekly_script.steps.add(self.p6_boys_attendance_step)
        self.p6_girls_attendance_step = ScriptStep.objects.create(
            script=self.teachers_weekly_script,
            poll=self.p6_girls_absent_poll,
            order=1,
            rule=ScriptStep.WAIT_MOVEON,
            start_offset=0,
            giveup_offset=7200)
        self.teachers_weekly_script.steps.add(self.p6_girls_attendance_step)
        self.p6_boys_enroll_poll = create_poll_with_reporters(
            "edtrac_boysp6_enrollment",
            "How many boys are enrolled in P6 this term?", Poll.TYPE_NUMERIC,
            self.admin_user, [self.emis_reporter1])
        self.p6_girls_enroll_poll = create_poll_with_reporters(
            "edtrac_girlsp6_enrollment",
            "How many girls are enrolled in P6 this term?", Poll.TYPE_NUMERIC,
            self.admin_user, [self.emis_reporter1])

        self.head_teachers_termly_script = Script.objects.create(
            name='P6 Enrollment Headteacher Termly Script',
            slug='edtrac_p6_enrollment_headteacher_termly')
        self.head_teachers_termly_script.steps.add(
            ScriptStep.objects.create(script=self.head_teachers_termly_script,
                                      poll=self.p6_boys_enroll_poll,
                                      order=0,
                                      rule=ScriptStep.WAIT_MOVEON,
                                      start_offset=0,
                                      giveup_offset=7200))

        self.head_teachers_termly_script.steps.add(
            ScriptStep.objects.create(script=self.head_teachers_termly_script,
                                      poll=self.p6_girls_enroll_poll,
                                      order=1,
                                      rule=ScriptStep.WAIT_MOVEON,
                                      start_offset=0,
                                      giveup_offset=7200))
        settings.SCHOOL_TERM_START = dateutils.increment(
            datetime.datetime.today(), weeks=-4)
        settings.SCHOOL_TERM_END = dateutils.increment(
            datetime.datetime.today(), weeks=8)
    def setUp(self):
        self.smc_group = create_group("SMC")
        country = create_location_type("country")
        uganda_fields = {
            "rght": 15274,
            "level": 0,
            "tree_id": 1,
            "lft": 1,
            }
        self.uganda = create_location("uganda", country, **uganda_fields)
        admin_group = create_group("Admins")
        self.admin_user = create_user_with_group("John", admin_group, self.uganda)
        district = create_location_type("district")
        kampala_fields = {
            "rght": 10901,
            "tree_parent": None,
            "level": 1,
            "tree_id": 1,
            "lft": 10686,
            }
        kampala_point = {
            "latitude": "0.3162800000",
            "longitude": "32.5821900000"
        }
        self.kampala_district = create_location("Kampala", district, point=kampala_point, **kampala_fields)
        self.kampala_school = create_school("St. Joseph's", self.kampala_district)
        self.head_teacher_group = create_group("Head Teachers")
        self.emis_reporter1 = create_emis_reporters("dummy1", self.kampala_district, self.kampala_school, 12345,
                                                    self.head_teacher_group)
        self.emis_reporter1.grade ='P3'
        self.emis_reporter1.save()
        self.p3_boys_absent_poll = create_poll_with_reporters("edtrac_boysp3_attendance", "How many P3 boys are at school today?",
                                                              Poll.TYPE_NUMERIC, self.admin_user,
                                                              [self.emis_reporter1])
        self.p3_girls_absent_poll = create_poll_with_reporters("edtrac_girlsp3_attendance", "How many P3 girls are at school today?",
                                                              Poll.TYPE_NUMERIC, self.admin_user,
                                                              [self.emis_reporter1])

        self.teachers_weekly_script = Script.objects.create(name='Revised P3 Teachers Weekly Script',
                                                            slug='edtrac_p3_teachers_weekly')
        self.p3_boys_attendance_step = ScriptStep.objects.create(script=self.teachers_weekly_script, poll=self.p3_boys_absent_poll,
                                                                 order=0, rule=ScriptStep.WAIT_MOVEON, start_offset=0,
                                                                 giveup_offset=2)
        self.teachers_weekly_script.steps.add(self.p3_boys_attendance_step)

        self.p3_girls_attendance_step = ScriptStep.objects.create(script=self.teachers_weekly_script, poll=self.p3_girls_absent_poll,
                                                   order=1, rule=ScriptStep.WAIT_MOVEON, start_offset=0,
                                                   giveup_offset=2)
        self.teachers_weekly_script.steps.add(self.p3_girls_attendance_step)

        self.p3_boys_enroll_poll = create_poll_with_reporters("edtrac_boysp3_enrollment", "How many boys are enrolled in P3 this term?",
                                                               Poll.TYPE_NUMERIC, self.admin_user,
                                                               [self.emis_reporter1])
        self.p3_girls_enroll_poll = create_poll_with_reporters("edtrac_girlsp3_enrollment", "How many girls are enrolled in P3 this term?",
                                                               Poll.TYPE_NUMERIC, self.admin_user,
                                                               [self.emis_reporter1])
        self.head_teachers_termly_script = Script.objects.create(name='P3 Enrollment Headteacher Termly Script',
                                                            slug='edtrac_p3_enrollment_headteacher_termly')

        self.head_teachers_termly_script.steps.add(
            ScriptStep.objects.create(script=self.head_teachers_termly_script, poll=self.p3_boys_enroll_poll, order=0,
                                      rule=ScriptStep.WAIT_MOVEON, start_offset=0, giveup_offset=7200))

        self.head_teachers_termly_script.steps.add(
            ScriptStep.objects.create(script=self.head_teachers_termly_script, poll=self.p3_girls_enroll_poll, order=1,
                                      rule=ScriptStep.WAIT_MOVEON, start_offset=0, giveup_offset=7200))
        settings.SCHOOL_TERM_START = dateutils.increment(datetime.now(),weeks=-4)
        settings.SCHOOL_TERM_END = dateutils.increment(datetime.now(),weeks=8)
Exemple #6
0
    def setUp(self):
        smc_group = create_group('SMC')
        admin_group = create_group('Admins')
        country = create_location_type("country")
        uganda_fields = {
            "rght": 15274,
            "level": 0,
            "tree_id": 1,
            "lft": 1,
        }
        self.uganda = create_location("uganda", country, **uganda_fields)
        district = create_location_type("district")
        kampala_fields = {
            "rght": 10901,
            "tree_parent": self.uganda,
            "level": 1,
            "tree_id": 1,
            "lft": 10686,
        }
        kampala_point = {
            "latitude": "0.3162800000",
            "longitude": "32.5821900000"
        }
        self.kampala_district = create_location("Kampala",
                                                district,
                                                point=kampala_point,
                                                **kampala_fields)

        self.kampala_school = create_school("St. Joseph's",
                                            self.kampala_district)
        self.head_teachers_group = create_group('Head Teachers')
        self.emis_reporter1 = create_emis_reporters("dummy1",
                                                    self.kampala_district,
                                                    self.kampala_school, 12345,
                                                    self.head_teachers_group)
        self.emis_reporter2 = create_emis_reporters("dummy2",
                                                    self.kampala_district,
                                                    self.kampala_school, 12346,
                                                    self.head_teachers_group)
        self.emis_reporter3 = create_emis_reporters("dummy3",
                                                    self.kampala_district,
                                                    self.kampala_school, 12347,
                                                    self.head_teachers_group)
        self.emis_reporter4 = create_emis_reporters("dummy4",
                                                    self.kampala_district,
                                                    self.kampala_school, 12348,
                                                    smc_group)
        self.admin_user = create_user_with_group("John", admin_group,
                                                 self.uganda)
        self.water_source_poll = create_poll_with_reporters(
            'edtrac_water_source',
            "Does this school have a water source within 500 metres from the school? Answer yes or no",
            Poll.TYPE_TEXT, self.admin_user, [
                self.emis_reporter1, self.emis_reporter2, self.emis_reporter3,
                self.emis_reporter4
            ])
        self.water_source_poll.add_yesno_categories()
        self.water_source_poll.save()
        today = datetime(datetime.now().year,
                         datetime.now().month,
                         datetime.now().day)
        settings.SCHOOL_TERM_START = dateutils.increment(today, weeks=-5)
        settings.SCHOOL_TERM_END = dateutils.increment(today, weeks=7)
        self.term_range = [
            settings.SCHOOL_TERM_START, settings.SCHOOL_TERM_END
        ]
Exemple #7
0
    def setUp(self):
        country = create_location_type("country")
        uganda_fields = {
            "rght": 15274,
            "level": 0,
            "tree_id": 1,
            "lft": 1,
        }
        self.uganda = create_location("uganda", country, **uganda_fields)
        admin_group = create_group("Admins")
        self.smc_group = create_group("SMC")
        self.admin_user = create_user_with_group("John", admin_group,
                                                 self.uganda)

        district = create_location_type("district")
        kampala_fields = {
            "rght": 10901,
            "tree_parent": self.uganda,
            "level": 1,
            "tree_id": 1,
            "lft": 10686,
        }
        kampala_point = {
            "latitude": "0.3162800000",
            "longitude": "32.5821900000"
        }
        self.kampala_district = create_location("Kampala",
                                                district,
                                                point=kampala_point,
                                                **kampala_fields)
        self.kampala_school = create_school("St. Joseph's",
                                            self.kampala_district)
        self.kampala_school_lubaga = create_school("UMHS Lubaga",
                                                   self.kampala_district)
        self.head_teacher_group = create_group("Head Teachers")
        self.emis_reporter1 = create_emis_reporters("dummy1",
                                                    self.kampala_district,
                                                    self.kampala_school, 12345,
                                                    self.head_teacher_group)
        self.emis_reporter1.grade = 'P3'
        self.emis_reporter1.gender = 'M'
        self.emis_reporter1.save()
        self.emis_reporter2 = create_emis_reporters("dummy2",
                                                    self.kampala_district,
                                                    self.kampala_school, 12346,
                                                    self.head_teacher_group)

        self.emis_reporter2.grade = 'P3'
        self.emis_reporter2.gender = 'M'
        self.emis_reporter2.save()

        self.emis_reporter3 = create_emis_reporters("dummy1",
                                                    self.kampala_district,
                                                    self.kampala_school, 12347,
                                                    self.smc_group)
        self.emis_reporter3.gender = 'F'
        self.emis_reporter3.save()

        self.p3_boys_absent_poll = create_poll_with_reporters(
            "edtrac_boysp3_attendance",
            "How many P3 boys are at school today?", Poll.TYPE_NUMERIC,
            self.admin_user, [self.emis_reporter1, self.emis_reporter2])
        self.p3_girls_absent_poll = create_poll_with_reporters(
            "edtrac_girlsp3_attendance",
            "How many P3 girls are at school today?", Poll.TYPE_NUMERIC,
            self.admin_user, [self.emis_reporter1, self.emis_reporter2])

        self.p3_boys_enroll_poll = create_poll_with_reporters(
            "edtrac_boysp3_enrollment",
            "How many boys are enrolled in P3 this term?", Poll.TYPE_NUMERIC,
            self.admin_user, [self.emis_reporter1])
        self.p3_girls_enroll_poll = create_poll_with_reporters(
            "edtrac_girlsp3_enrollment",
            "How many girls are enrolled in P3 this term?", Poll.TYPE_NUMERIC,
            self.admin_user, [self.emis_reporter1])
        self.head_teacher_monitoring_poll = create_poll_with_reporters(
            "edtrac_head_teachers_attendance",
            "Has the head teacher been at school for at least 3 days? Answer YES or NO",
            Poll.TYPE_TEXT, self.admin_user, [self.emis_reporter3])
        self.teachers_weekly_script = Script.objects.create(
            name='Revised P3 Teachers Weekly Script',
            slug='edtrac_p3_teachers_weekly')

        self.p3_boys_attendance_step = ScriptStep.objects.create(
            script=self.teachers_weekly_script,
            poll=self.p3_boys_absent_poll,
            order=0,
            rule=ScriptStep.WAIT_MOVEON,
            start_offset=0,
            giveup_offset=2)
        self.teachers_weekly_script.steps.add(self.p3_boys_attendance_step)

        self.p3_girls_attendance_step = ScriptStep.objects.create(
            script=self.teachers_weekly_script,
            poll=self.p3_girls_absent_poll,
            order=1,
            rule=ScriptStep.WAIT_MOVEON,
            start_offset=0,
            giveup_offset=2)
        self.teachers_weekly_script.steps.add(self.p3_girls_attendance_step)

        self.head_teachers_termly_script = Script.objects.create(
            name='P3 Enrollment Headteacher Termly Script',
            slug='edtrac_p3_enrollment_headteacher_termly')
        self.head_teacher_weekly_script = Script.objects.create(
            name='Education monitoring smc weekly script',
            slug='edtrac_education_monitoring_smc_weekly_script')
        self.head_teachers_termly_script.steps.add(
            ScriptStep.objects.create(script=self.head_teachers_termly_script,
                                      poll=self.p3_boys_enroll_poll,
                                      order=0,
                                      rule=ScriptStep.WAIT_MOVEON,
                                      start_offset=0,
                                      giveup_offset=7200))

        self.head_teachers_termly_script.steps.add(
            ScriptStep.objects.create(script=self.head_teachers_termly_script,
                                      poll=self.p3_girls_enroll_poll,
                                      order=1,
                                      rule=ScriptStep.WAIT_MOVEON,
                                      start_offset=0,
                                      giveup_offset=7200))
        self.head_teacher_weekly_script.steps.add(
            ScriptStep.objects.create(script=self.head_teacher_weekly_script,
                                      poll=self.head_teacher_monitoring_poll,
                                      order=0,
                                      rule=ScriptStep.WAIT_MOVEON,
                                      start_offset=0,
                                      giveup_offset=7200))

        settings.SCHOOL_TERM_START = dateutils.increment(
            datetime.datetime.today(), weeks=-4)
        settings.SCHOOL_TERM_END = dateutils.increment(
            datetime.datetime.today(), weeks=8)
        self.term_range = [
            getattr(settings, 'SCHOOL_TERM_START'),
            getattr(settings, 'SCHOOL_TERM_END')
        ]

        create_attribute()
    def setUp(self):
        country = create_location_type("country")
        uganda_fields = {
            "rght": 15274,
            "level": 0,
            "tree_id": 1,
            "lft": 1,
        }
        self.uganda = create_location("uganda", country, **uganda_fields)
        admin_group = create_group("Admins")
        self.smc_group = create_group("SMC")
        self.admin_user = create_user_with_group("John", admin_group, self.uganda)

        district = create_location_type("district")
        kampala_fields = {
            "rght": 10901,
            "tree_parent": self.uganda,
            "level": 1,
            "tree_id": 1,
            "lft": 10686,
            }
        kampala_point = {
            "latitude": "0.3162800000",
            "longitude": "32.5821900000"
        }
        self.kampala_district = create_location("Kampala", district, point=kampala_point, **kampala_fields)
        self.kampala_school = create_school("St. Joseph's", self.kampala_district)
        self.head_teacher_group = create_group("Head Teachers")
        self.emis_reporter1 = create_emis_reporters("dummy1", self.kampala_district, self.kampala_school, 12345,
                                                    self.head_teacher_group)
        self.emis_reporter1.grade ='P3'
        self.emis_reporter1.save()
        self.emis_reporter2 = create_emis_reporters("dummy2", self.kampala_district, self.kampala_school, 12346,
                                                    self.head_teacher_group)
        self.emis_reporter2.grade ='P3'
        self.emis_reporter2.save()

        self.emis_reporter3 = create_emis_reporters("dummy1", self.kampala_district, self.kampala_school, 12347,
                                                    self.smc_group)

        self.p3_boys_absent_poll = create_poll_with_reporters("edtrac_boysp3_attendance", "How many P3 boys are at school today?",
                                                              Poll.TYPE_NUMERIC, self.admin_user,
                                                              [self.emis_reporter1, self.emis_reporter2])
        self.p3_girls_absent_poll = create_poll_with_reporters("edtrac_girlsp3_attendance", "How many P3 girls are at school today?",
                                                              Poll.TYPE_NUMERIC, self.admin_user,
                                                              [self.emis_reporter1, self.emis_reporter2])

        self.teachers_weekly_script = Script.objects.create(name='Revised P3 Teachers Weekly Script',
                                            slug='edtrac_p3_teachers_weekly')
        self.p3_boys_attendance_step = ScriptStep.objects.create(script=self.teachers_weekly_script, poll=self.p3_boys_absent_poll,
                                                   order=0, rule=ScriptStep.WAIT_MOVEON, start_offset=0,
                                                   giveup_offset=2)
        self.teachers_weekly_script.steps.add(
            self.p3_boys_attendance_step)
        self.p3_girls_attendance_step = ScriptStep.objects.create(script=self.teachers_weekly_script, poll=self.p3_girls_absent_poll,
                                                   order=1, rule=ScriptStep.WAIT_MOVEON, start_offset=0,
                                                   giveup_offset=2)
        self.teachers_weekly_script.steps.add(
            self.p3_girls_attendance_step)

        self.p3_boys_enroll_poll = create_poll_with_reporters("edtrac_boysp3_enrollment", "How many boys are enrolled in P3 this term?",
                                                               Poll.TYPE_NUMERIC, self.admin_user,
                                                               [self.emis_reporter1])
        self.p3_girls_enroll_poll = create_poll_with_reporters("edtrac_girlsp3_enrollment", "How many girls are enrolled in P3 this term?",
                                                               Poll.TYPE_NUMERIC, self.admin_user,
                                                               [self.emis_reporter1])

        self.head_teachers_termly_script = Script.objects.create(name='P3 Enrollment Headteacher Termly Script',
                                                            slug='edtrac_p3_enrollment_headteacher_termly')
        self.head_teachers_termly_script.steps.add(
            ScriptStep.objects.create(script=self.head_teachers_termly_script, poll=self.p3_boys_enroll_poll, order=0,
                                      rule=ScriptStep.WAIT_MOVEON, start_offset=0, giveup_offset=7200 ))

        self.head_teachers_termly_script.steps.add(
            ScriptStep.objects.create(script=self.head_teachers_termly_script, poll=self.p3_girls_enroll_poll, order=1,
                                      rule=ScriptStep.WAIT_MOVEON, start_offset=0, giveup_offset=7200 ))


        self.head_teacher_poll = create_poll_with_reporters("edtrac_head_teachers_attendance", "Has the head teacher been at school for at least 3 days? Answer YES or NO",
                                                               Poll.TYPE_TEXT, self.admin_user,
                                                               [self.emis_reporter3])
        self.head_teacher_poll.add_yesno_categories()
        self.head_teacher_poll.save()
        self.smc_weekly_script = Script.objects.create(name='Education monitoring smc weekly script',
                                                                 slug='edtrac_smc_weekly')
        self.smc_weekly_script.steps.add(
            ScriptStep.objects.create(script=self.smc_weekly_script, poll=self.head_teacher_poll, order=0,
                                      rule=ScriptStep.WAIT_MOVEON, start_offset=0, giveup_offset=7200 ))

        self.head_teachers_weekly_script = Script.objects.create(name = "Teachers weekly attendance script",
                                                            slug = 'edtrac_head_teachers_weekly')
        self.male_teachers_attendance_poll = create_poll_with_reporters(
            "edtrac_m_teachers_attendance", "How many male teachers were in school this week?",
            Poll.TYPE_NUMERIC, self.admin_user, [self.emis_reporter1])

        self.female_teachers_attendance_poll = create_poll_with_reporters(
            "edtrac_f_teachers_attendance", "How many female teachers were in school this week?",
            Poll.TYPE_NUMERIC, self.admin_user, [self.emis_reporter1])

        self.male_teacher_deployment_poll = create_poll_with_reporters(
            "edtrac_m_teachers_deployment", "How many male teachers were deployed in school this term?",
            Poll.TYPE_NUMERIC, self.admin_user, [self.emis_reporter1])


        self.female_teacher_deployment_poll = create_poll_with_reporters(
            "edtrac_f_teachers_deployment", "How many female teachers were deployed this term?",
            Poll.TYPE_NUMERIC, self.admin_user, [self.emis_reporter1])

        self.head_teachers_weekly_script.steps.add(
            ScriptStep.objects.create(script=self.head_teachers_weekly_script, poll=self.female_teacher_deployment_poll,
                order=0, rule=ScriptStep.WAIT_MOVEON, start_offset=0, giveup_offset=1)
        )

        self.head_teachers_weekly_script.steps.add(
            ScriptStep.objects.create(script=self.head_teachers_weekly_script, poll=self.male_teacher_deployment_poll,
                order=1, rule=ScriptStep.WAIT_MOVEON, start_offset=0, giveup_offset=1)
        )

        self.head_teachers_weekly_script.steps.add(
            ScriptStep.objects.create(script=self.head_teachers_weekly_script, poll=self.female_teachers_attendance_poll,
                order=2, rule=ScriptStep.WAIT_MOVEON, start_offset=0, giveup_offset=1)
        )

        self.male_teacher_step = ScriptStep.objects.create(script=self.head_teachers_weekly_script,
                                                           poll=self.male_teachers_attendance_poll, order=3, rule=ScriptStep.WAIT_MOVEON, start_offset=0, giveup_offset=1)
        self.head_teachers_weekly_script.steps.add(
            self.male_teacher_step
        )


        settings.SCHOOL_TERM_START = dateutils.increment(datetime.today(),weeks=-4)
        settings.SCHOOL_TERM_END = dateutils.increment(datetime.today(),weeks=8)