コード例 #1
0
 def setUp(self):
     district_type = create_location_type('district')
     county_type = create_location_type('county')
     self.kampala_district = create_location('kampala', district_type)
     self.masaka_district= create_location('masaka', district_type)
     self.kasese_county = create_location('kasese',county_type)
     self.emis_reporter = EmisReporter.objects.create(name="Akshay Naval")
     self.school1 = create_school("Standard High School", self.kampala_district)
     self.school2 = create_school("Makerere College School", self.kampala_district)
     self.school3 = create_school("St. Henry's College Kitovu", self.masaka_district)
コード例 #2
0
 def setUp(self):
     district_type = create_location_type('district')
     county_type = create_location_type('county')
     self.kampala_district = create_location('kampala', district_type)
     self.masaka_district = create_location('masaka', district_type)
     self.kasese_county = create_location('kasese', county_type)
     self.emis_reporter = EmisReporter.objects.create(name="Akshay Naval")
     self.school1 = create_school("Standard High School",
                                  self.kampala_district)
     self.school2 = create_school("Makerere College School",
                                  self.kampala_district)
     self.school3 = create_school("St. Henry's College Kitovu",
                                  self.masaka_district)
コード例 #3
0
    def setUp(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)
        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, None, 12346, self.head_teachers_group)
        self.emis_reporter3 = create_emis_reporters("dummy3", self.uganda, self.kampala_school, 12347, self.head_teachers_group)
        self.emis_reporter4 = create_emis_reporters("dummy4", self.kampala_district, self.kampala_school, 12348, smc_group)
コード例 #4
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")
     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.admin_user = create_user_with_group("John", admin_group,
                                              self.uganda)
コード例 #5
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")
     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.admin_user = create_user_with_group("John", admin_group, self.uganda)
コード例 #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]
コード例 #7
0
    def setUp(self):
        super(TestAbsenteeismViewHelper, self).setUp()
        self.kampala_school1 = create_school("St. Joseph's", self.kampala_district)
        self.smc_group = create_group("SMC")
        self.emis_reporter5 = create_emis_reporters('Derek', self.kampala_district, self.kampala_school, 1234557,
                                                    self.smc_group)
        self.emis_reporter6 = create_emis_reporters('Peter', self.kampala_district, self.kampala_school1, 1234558,
                                                    self.smc_group)
        self.head_teachers_group = create_group("Head Teachers")
        self.emis_reporter7 = create_emis_reporters('John', self.kampala_district, self.kampala_school, 1234559,
                                                    self.head_teachers_group)
        self.emis_reporter7.gender = 'M'
        self.emis_reporter7.save()
        self.emis_reporter8 = create_emis_reporters('James', self.kampala_district, self.kampala_school1, 1234550,
                                                    self.head_teachers_group)
        self.emis_reporter8.gender = 'm'
        self.emis_reporter8.save()
        self.head_teachers_script = Script.objects.create(name='Education monitoring smc weekly script',
                                                     slug='edtrac_smc_weekly')
        self.head_teachers_poll, self.head_teachers_poll_created = Poll.objects.get_or_create(
            name='edtrac_head_teachers_attendance',
            user=self.admin_user,
            type=Poll.TYPE_TEXT,
            question='Has the head teacher been at school for at least 3 days? Answer YES or NO',
            default_response='')
        self.head_teachers_poll.add_yesno_categories()
        self.head_teachers_poll.save()
        self.head_teachers_script.steps.add(
            ScriptStep.objects.create(script=self.head_teachers_script, poll=self.head_teachers_poll, order=0,
                                      rule=ScriptStep.WAIT_MOVEON, start_offset=0, giveup_offset=86400 ))

        self.teachers_weekly_script = Script.objects.create(name='Revised P3 Teachers Weekly Script',slug='edtrac_p3_teachers_weekly')
        self.p3_boys_absent_poll.contacts.add(self.emis_reporter7)
        self.p3_boys_absent_poll.contacts.add(self.emis_reporter8)
        self.p3_boys_absent_poll.save()
        self.teachers_weekly_script.steps.add(
            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=7200 ))

        settings.SCHOOL_TERM_START = dateutils.increment(datetime.datetime.now(),weeks=-8)
        settings.SCHOOL_TERM_END = dateutils.increment(datetime.datetime.now(),weeks=1)
        self.date_week = get_week_date(4)
コード例 #8
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.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)
コード例 #9
0
    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)
コード例 #10
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
        ]
コード例 #11
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()
コード例 #12
0
    def setUp(self):
        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. Josephs",
                                            self.kampala_district)
        self.kampala_school1 = create_school("St. Marys",
                                             self.kampala_district)
        user, created = User.objects.get_or_create(username='******')
        self.auto_reg_script = Script.objects.create(
            name='Edutrac Registration Script', slug='edtrac_autoreg')
        self.role_poll = Poll.objects.create(
            name='edtrac_role',
            question=
            'Thank you for participating in EduTrac. What is your role? Answer with 1, 2, 3, 4, 5 or 6 for 1=Teacher, 2=Head Teacher, 3=SMC, 4=GEM, 5=DEO, 6=MEO',
            type=Poll.TYPE_TEXT,
            user=user)
        self.role_step = ScriptStep.objects.create(script=self.auto_reg_script,
                                                   poll=self.role_poll,
                                                   order=0,
                                                   rule=ScriptStep.WAIT_MOVEON,
                                                   start_offset=0,
                                                   giveup_offset=3)

        self.gender_poll = Poll.objects.create(
            name='edtrac_gender',
            question='Are you female or male?',
            type=Poll.TYPE_TEXT,
            user=user)
        self.gender_step = ScriptStep.objects.create(
            script=self.auto_reg_script,
            poll=self.gender_poll,
            order=1,
            rule=ScriptStep.WAIT_MOVEON,
            start_offset=0,
            giveup_offset=3)

        self.class_poll = Poll.objects.create(
            name='edtrac_class',
            question='Which class do you teach? P3 or P6',
            type=Poll.TYPE_TEXT,
            user=user)
        self.class_step = ScriptStep.objects.create(
            script=self.auto_reg_script,
            poll=self.class_poll,
            order=2,
            rule=ScriptStep.WAIT_MOVEON,
            start_offset=0,
            giveup_offset=3)

        self.district_poll = Poll.objects.create(
            name='edtrac_district',
            question='In which district is your school found?',
            type=Poll.TYPE_TEXT,
            user=user)
        self.district_step = ScriptStep.objects.create(
            script=self.auto_reg_script,
            poll=self.district_poll,
            order=3,
            rule=ScriptStep.WAIT_MOVEON,
            start_offset=0,
            giveup_offset=7200)

        self.subcounty_poll = Poll.objects.create(
            name='edtrac_subcounty',
            question=
            'What is the name of the sub county in which your school is found?',
            type=Poll.TYPE_TEXT,
            user=user)
        self.subcounty_step = ScriptStep.objects.create(
            script=self.auto_reg_script,
            poll=self.subcounty_poll,
            order=4,
            rule=ScriptStep.WAIT_MOVEON,
            start_offset=0,
            giveup_offset=7200)

        self.school_poll = Poll.objects.create(
            name='edtrac_school',
            question='What is the name of your school?',
            type=Poll.TYPE_TEXT,
            user=user)
        self.school_step = ScriptStep.objects.create(
            script=self.auto_reg_script,
            poll=self.school_poll,
            order=5,
            rule=ScriptStep.WAIT_MOVEON,
            start_offset=0,
            giveup_offset=7200)

        self.name_poll = Poll.objects.create(name='edtrac_name',
                                             question='What is your name?',
                                             type=Poll.TYPE_TEXT,
                                             user=user)
        self.name_step = ScriptStep.objects.create(script=self.auto_reg_script,
                                                   poll=self.name_poll,
                                                   order=6,
                                                   rule=ScriptStep.WAIT_MOVEON,
                                                   start_offset=0,
                                                   giveup_offset=7200)
        self.welcome_step = ScriptStep.objects.create(
            script=self.auto_reg_script,
            message=
            "Welcome to EduTrac.The information you shall provide contributes to keeping children in school.",
            order=7,
            rule=ScriptStep.WAIT_MOVEON,
            start_offset=0,
            giveup_offset=0,
        )

        self.backend = Backend.objects.create(name='test')
        self.connection = Connection.objects.create(identity='8675309',
                                                    backend=self.backend)
        self.create_roles()
コード例 #13
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.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)
コード例 #14
0
    def setUp(self):
        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. Josephs", self.kampala_district)
        self.kampala_school1 = create_school("St. Marys", self.kampala_district)
        user ,created = User.objects.get_or_create(username='******')
        self.auto_reg_script = Script.objects.create(name='Edutrac Registration Script', slug='edtrac_autoreg')
        self.role_poll = Poll.objects.create(name='edtrac_role',
                                             question='Thank you for participating in EduTrac. What is your role? Answer with 1, 2, 3, 4, 5 or 6 for 1=Teacher, 2=Head Teacher, 3=SMC, 4=GEM, 5=DEO, 6=MEO',
                                             type=Poll.TYPE_TEXT,
                                             user=user)
        self.role_step = ScriptStep.objects.create(script=self.auto_reg_script, poll=self.role_poll, order=0,
                                  rule=ScriptStep.WAIT_MOVEON, start_offset=0, giveup_offset=3)

        self.gender_poll = Poll.objects.create(name='edtrac_gender',
                                             question='Are you female or male?',
                                             type=Poll.TYPE_TEXT,
                                             user=user)
        self.gender_step = ScriptStep.objects.create(script=self.auto_reg_script, poll=self.gender_poll, order=1,
                                  rule=ScriptStep.WAIT_MOVEON, start_offset=0, giveup_offset=3)

        self.class_poll = Poll.objects.create(name='edtrac_class',
                                             question='Which class do you teach? P3 or P6',
                                             type=Poll.TYPE_TEXT,
                                             user=user)
        self.class_step = ScriptStep.objects.create(script=self.auto_reg_script, poll=self.class_poll, order=2,
                                  rule=ScriptStep.WAIT_MOVEON, start_offset=0, giveup_offset=3)

        self.district_poll = Poll.objects.create(name='edtrac_district',
                                             question='In which district is your school found?',
                                             type=Poll.TYPE_TEXT,
                                             user=user)
        self.district_step = ScriptStep.objects.create(script=self.auto_reg_script, poll=self.district_poll, order=3,
                                  rule=ScriptStep.WAIT_MOVEON, start_offset=0, giveup_offset=7200)

        self.subcounty_poll = Poll.objects.create(name='edtrac_subcounty',
                                             question='What is the name of the sub county in which your school is found?',
                                             type=Poll.TYPE_TEXT,
                                             user=user)
        self.subcounty_step = ScriptStep.objects.create(script=self.auto_reg_script, poll=self.subcounty_poll, order=4,
                                  rule=ScriptStep.WAIT_MOVEON, start_offset=0, giveup_offset=7200)

        self.school_poll = Poll.objects.create(name='edtrac_school',
                                             question='What is the name of your school?',
                                             type=Poll.TYPE_TEXT,
                                             user=user)
        self.school_step = ScriptStep.objects.create(script=self.auto_reg_script, poll=self.school_poll, order=5,
                                  rule=ScriptStep.WAIT_MOVEON, start_offset=0, giveup_offset=7200)

        self.name_poll = Poll.objects.create(name='edtrac_name',
                                             question='What is your name?',
                                             type=Poll.TYPE_TEXT,
                                             user=user)
        self.name_step = ScriptStep.objects.create(script=self.auto_reg_script, poll=self.name_poll, order=6,
                                  rule=ScriptStep.WAIT_MOVEON, start_offset=0, giveup_offset=7200)
        self.welcome_step = ScriptStep.objects.create(
            script=self.auto_reg_script,
            message="Welcome to EduTrac.The information you shall provide contributes to keeping children in school.",
            order=7,rule=ScriptStep.WAIT_MOVEON,start_offset=0,giveup_offset=0,)

        self.backend = Backend.objects.create(name='test')
        self.connection = Connection.objects.create(identity='8675309', backend=self.backend)
        self.create_roles()