Esempio n. 1
0
    def test_male_and_female_head_teachers_attendance_on_holiday(self):
        d1, d2 = get_week_date(depth=2)
        settings.SCHOOL_HOLIDAYS = [(d1[0], d1[1]), (d2[0], d2[1])]
        self.create_emisreporters_of_smc_group()
        self.m_head_teachers_attendance_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.user,
            [self.emisreporter4, self.emisreporter5, self.emisreporter6])

        self.m_head_teachers_attendance_poll.add_yesno_categories()
        self.m_head_teachers_attendance_poll.save()
        self.m_head_teachers_attendance_poll.start()
        self.fake_incoming_with_date('yes', self.connection4,
                                     self.poll_response_current_week_date)
        self.fake_incoming_with_date('yes', self.connection5,
                                     self.poll_response_current_week_date)
        self.fake_incoming_with_date('no', self.connection6,
                                     self.poll_response_current_week_date)

        self.fake_incoming_with_date('no', self.connection4,
                                     self.poll_response_past_week_date)
        self.fake_incoming_with_date('no', self.connection5,
                                     self.poll_response_past_week_date)
        self.fake_incoming_with_date('yes', self.connection6,
                                     self.poll_response_past_week_date)
        result_m_head_teachers = head_teachers_male(
            self.root_node.get_children())
        result_f_head_teachers = head_teachers_female(
            self.root_node.get_children())

        self.assertEqual("--", result_m_head_teachers['m_head_t_week_before'])
        self.assertEqual("--", result_f_head_teachers['f_head_t_week_before'])
Esempio n. 2
0
    def test_male_and_female_head_teachers_attendance(self):

        params = {
            "description":
            "A response value for a Poll with expected text responses",
            "datatype": "text",
            "enum_group": None,
            "required": False,
            "type": None,
            "slug": "poll_text_value",
            "name": "Text"
        }
        Attribute.objects.get_or_create(**params)

        settings.SCHOOL_HOLIDAYS = []
        self.create_emisreporters_of_smc_group()
        self.m_head_teachers_attendance_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.user,
            [self.emisreporter4, self.emisreporter5, self.emisreporter6])

        self.m_head_teachers_attendance_poll.add_yesno_categories()
        self.m_head_teachers_attendance_poll.save()
        self.m_head_teachers_attendance_poll.start()
        self.fake_incoming_with_date('yes', self.connection4,
                                     self.poll_response_current_week_date)
        self.fake_incoming_with_date('yes', self.connection5,
                                     self.poll_response_current_week_date)
        self.fake_incoming_with_date('no', self.connection6,
                                     self.poll_response_current_week_date)

        self.fake_incoming_with_date('no', self.connection4,
                                     self.poll_response_past_week_date)
        self.fake_incoming_with_date('no', self.connection5,
                                     self.poll_response_past_week_date)
        self.fake_incoming_with_date('yes', self.connection6,
                                     self.poll_response_past_week_date)
        result_m_head_teachers = head_teachers_male(
            self.root_node.get_children(), self.get_time)
        result_f_head_teachers = head_teachers_female(
            self.root_node.get_children(), self.get_time)

        self.assertAlmostEqual(100.00,
                               result_m_head_teachers['m_head_t_week'],
                               places=1)
        self.assertAlmostEqual(0.00,
                               result_m_head_teachers['m_head_t_week_before'],
                               places=1)

        self.assertAlmostEqual(50.00,
                               result_f_head_teachers['f_head_t_week'],
                               places=1)
        self.assertAlmostEqual(50.00,
                               result_f_head_teachers['f_head_t_week_before'],
                               places=1)
Esempio n. 3
0
    def test_male_and_female_head_teachers_attendance(self):

        params = {
            "description": "A response value for a Poll with expected text responses",
            "datatype": "text",
            "enum_group": None,
            "required": False,
            "type": None,
            "slug": "poll_text_value",
            "name": "Text"
        }
        Attribute.objects.get_or_create(**params)

        settings.SCHOOL_HOLIDAYS = []
        self.create_emisreporters_of_smc_group()
        self.m_head_teachers_attendance_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.user,
                                                         [self.emisreporter4,self.emisreporter5,self.emisreporter6])

        self.m_head_teachers_attendance_poll.add_yesno_categories()
        self.m_head_teachers_attendance_poll.save()
        self.m_head_teachers_attendance_poll.start()
        self.fake_incoming_with_date('yes', self.connection4, self.poll_response_current_week_date)
        self.fake_incoming_with_date('yes', self.connection5, self.poll_response_current_week_date)
        self.fake_incoming_with_date('no', self.connection6, self.poll_response_current_week_date)

        self.fake_incoming_with_date('no', self.connection4, self.poll_response_past_week_date)
        self.fake_incoming_with_date('no', self.connection5, self.poll_response_past_week_date)
        self.fake_incoming_with_date('yes', self.connection6, self.poll_response_past_week_date)
        result_m_head_teachers=head_teachers_male(self.root_node.get_children(), self.get_time)
        result_f_head_teachers=head_teachers_female(self.root_node.get_children(), self.get_time)

        self.assertAlmostEqual(100.00,result_m_head_teachers['m_head_t_week'],places=1)
        self.assertAlmostEqual(0.00,result_m_head_teachers['m_head_t_week_before'],places=1)

        self.assertAlmostEqual(50.00,result_f_head_teachers['f_head_t_week'],places=1)
        self.assertAlmostEqual(50.00,result_f_head_teachers['f_head_t_week_before'],places=1)
Esempio n. 4
0
    def test_male_and_female_head_teachers_attendance_on_holiday(self):
        d1,d2 = get_week_date(depth = 2)
        settings.SCHOOL_HOLIDAYS = [(d1[0],d1[1]) , (d2[0],d2[1])]
        self.create_emisreporters_of_smc_group()
        self.m_head_teachers_attendance_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.user,
                                                         [self.emisreporter4,self.emisreporter5,self.emisreporter6])

        self.m_head_teachers_attendance_poll.add_yesno_categories()
        self.m_head_teachers_attendance_poll.save()
        self.m_head_teachers_attendance_poll.start()
        self.fake_incoming_with_date('yes', self.connection4, self.poll_response_current_week_date)
        self.fake_incoming_with_date('yes', self.connection5, self.poll_response_current_week_date)
        self.fake_incoming_with_date('no', self.connection6, self.poll_response_current_week_date)

        self.fake_incoming_with_date('no', self.connection4, self.poll_response_past_week_date)
        self.fake_incoming_with_date('no', self.connection5, self.poll_response_past_week_date)
        self.fake_incoming_with_date('yes', self.connection6, self.poll_response_past_week_date)
        result_m_head_teachers=head_teachers_male(self.root_node.get_children())
        result_f_head_teachers=head_teachers_female(self.root_node.get_children())

        self.assertEqual("--",result_m_head_teachers['m_head_t_week_before'])
        self.assertEqual("--",result_f_head_teachers['f_head_t_week_before'])