コード例 #1
0
ファイル: test_dashboard.py プロジェクト: skamille/orchestra
    def test_task_timing(self):
        """
        Ensure that timing information is properly recorded across
        submissions/rejections/acceptances.
        """
        task = setup_task_history(self)

        self._verify_good_task_assignment_information(
            self.clients[6], {'task_id': task.id},
            task.project.short_description,
            'Submitted',
            'Complete',
            False,
            True, {'test': 'test'},
            self.workers[6],
            work_times_seconds=[36, 38, 35])

        self._verify_good_task_assignment_information(
            self.clients[7], {'task_id': task.id},
            task.project.short_description,
            'Submitted',
            'Complete',
            True,
            True, {'test': 'test'},
            self.workers[7],
            work_times_seconds=[36, 38])
コード例 #2
0
ファイル: test_analytics.py プロジェクト: dretelny/orchestra
    def test_calendar_time_sum(self):
        task = setup_task_history(self)
        df = work_time_df([task.project])

        # Duplicate the amount of work completed by creating a ficitonal
        # second set of tasks.  The calendar times are the same, so the
        # project shouldn't have double the calendar time.
        duplicate = df.copy(deep=True)
        duplicate['task_id'] = duplicate.task_id + 1
        df = concat([df, duplicate])

        header = ['calendar_time']

        # Test grouping by project ID
        expected = DataFrame(
            [(timedelta(hours=3, minutes=13))],
            columns=header)
        returned = calendar_time_sum(df, ['project_id'])
        assert_frame_equal(returned[header], expected)

        # Test grouping by task ID
        expected = DataFrame(
            [(timedelta(hours=3, minutes=13),),
             (timedelta(hours=3, minutes=13),)],
            columns=header)
        returned = calendar_time_sum(df, ['project_id', 'task_id'])
        assert_frame_equal(returned[header], expected)
コード例 #3
0
ファイル: test_analytics.py プロジェクト: dretelny/orchestra
    def test_work_time_df(self):
        task = setup_task_history(self)
        returned = work_time_df([task.project])

        self.assertEquals(returned.project_id.nunique(), 1)
        self.assertEquals(returned.task_id.nunique(), 1)

        header = ['assignment_level', 'worker', 'iteration', 'start_datetime',
                  'end_datetime', 'calendar_time', 'work_time']
        expected = DataFrame(
            [(1, 'test_user_5', 0, parse('2015-10-12T01:00:00+00:00'), parse('2015-10-12T02:00:00+00:00'), timedelta(hours=1), timedelta(seconds=0)),  # noqa
             (1, 'test_user_5', 1, parse('2015-10-12T02:00:00+00:00'), parse('2015-10-12T02:02:00+00:00'), timedelta(minutes=2), timedelta(seconds=35)),  # noqa
             (2, 'test_user_6', 0, parse('2015-10-12T02:02:00+00:00'), parse('2015-10-12T03:00:00+00:00'), timedelta(minutes=58), timedelta(seconds=0)),  # noqa
             (2, 'test_user_6', 1, parse('2015-10-12T03:00:00+00:00'), parse('2015-10-12T03:01:00+00:00'), timedelta(minutes=1), timedelta(seconds=36)),  # noqa
             (1, 'test_user_5', 2, parse('2015-10-12T03:01:00+00:00'), parse('2015-10-12T03:05:00+00:00'), timedelta(minutes=4), timedelta(seconds=37)),  # noqa
             (2, 'test_user_6', 2, parse('2015-10-12T03:05:00+00:00'), parse('2015-10-12T03:07:00+00:00'), timedelta(minutes=2), timedelta(seconds=38)),  # noqa
             (3, 'test_user_7', 0, parse('2015-10-12T03:07:00+00:00'), parse('2015-10-12T04:00:00+00:00'), timedelta(minutes=53), timedelta(seconds=0)),  # noqa
             (3, 'test_user_7', 1, parse('2015-10-12T04:00:00+00:00'), parse('2015-10-12T04:02:00+00:00'), timedelta(minutes=2), timedelta(seconds=36)),  # noqa
             (2, 'test_user_6', 3, parse('2015-10-12T04:02:00+00:00'), parse('2015-10-12T04:03:00+00:00'), timedelta(minutes=1), timedelta(seconds=35)),  # noqa
             (3, 'test_user_7', 2, parse('2015-10-12T04:03:00+00:00'), parse('2015-10-12T04:13:00+00:00'), timedelta(minutes=10), timedelta(seconds=38)),  # noqa
            ],
            columns=header)

        expected['start_datetime'] = (
            expected['start_datetime'].astype('datetime64[ns]'))
        expected['end_datetime'] = (
            expected['end_datetime'].astype('datetime64[ns]'))

        assert_frame_equal(returned[header], expected)
コード例 #4
0
ファイル: test_analytics.py プロジェクト: skamille/orchestra
    def test_calendar_time_sum(self):
        task = setup_task_history(self)
        df = work_time_df([task.project])

        # Duplicate the amount of work completed by creating a ficitonal
        # second set of tasks.  The calendar times are the same, so the
        # project shouldn't have double the calendar time.
        duplicate = df.copy(deep=True)
        duplicate['task_id'] = duplicate.task_id + 1
        df = concat([df, duplicate])

        header = ['calendar_time']

        # Test grouping by project ID
        expected = DataFrame([(timedelta(hours=3, minutes=13))],
                             columns=header)
        returned = calendar_time_sum(df, ['project_id'])
        assert_frame_equal(returned[header], expected)

        # Test grouping by task ID
        expected = DataFrame([(timedelta(hours=3, minutes=13), ),
                              (timedelta(hours=3, minutes=13), )],
                             columns=header)
        returned = calendar_time_sum(df, ['project_id', 'task_id'])
        assert_frame_equal(returned[header], expected)
コード例 #5
0
ファイル: test_analytics.py プロジェクト: skamille/orchestra
    def test_work_time_sum(self):
        task = setup_task_history(self)
        df = work_time_df([task.project])

        header = ['work_time']
        expected = DataFrame([(timedelta(minutes=4, seconds=15))],
                             columns=header)
        returned = work_time_sum(df, ['project_id'])

        assert_frame_equal(returned[header], expected)
コード例 #6
0
ファイル: test_analytics.py プロジェクト: dretelny/orchestra
    def test_work_time_sum(self):
        task = setup_task_history(self)
        df = work_time_df([task.project])

        header = ['work_time']
        expected = DataFrame(
            [(timedelta(minutes=4, seconds=15))],
            columns=header)
        returned = work_time_sum(df, ['project_id'])

        assert_frame_equal(returned[header], expected)
コード例 #7
0
ファイル: test_analytics.py プロジェクト: skamille/orchestra
    def test_work_time_df(self):
        task = setup_task_history(self)
        returned = work_time_df([task.project])

        self.assertEquals(returned.project_id.nunique(), 1)
        self.assertEquals(returned.task_id.nunique(), 1)

        header = [
            'assignment_level', 'worker', 'iteration', 'start_datetime',
            'end_datetime', 'calendar_time', 'work_time'
        ]
        expected = DataFrame(
            [
                (1, 'test_user_5', 0, parse('2015-10-12T01:00:00+00:00'),
                 parse('2015-10-12T02:00:00+00:00'), timedelta(hours=1),
                 timedelta(seconds=0)),  # noqa
                (1, 'test_user_5', 1, parse('2015-10-12T02:00:00+00:00'),
                 parse('2015-10-12T02:02:00+00:00'), timedelta(minutes=2),
                 timedelta(seconds=35)),  # noqa
                (2, 'test_user_6', 0, parse('2015-10-12T02:02:00+00:00'),
                 parse('2015-10-12T03:00:00+00:00'), timedelta(minutes=58),
                 timedelta(seconds=0)),  # noqa
                (2, 'test_user_6', 1, parse('2015-10-12T03:00:00+00:00'),
                 parse('2015-10-12T03:01:00+00:00'), timedelta(minutes=1),
                 timedelta(seconds=36)),  # noqa
                (1, 'test_user_5', 2, parse('2015-10-12T03:01:00+00:00'),
                 parse('2015-10-12T03:05:00+00:00'), timedelta(minutes=4),
                 timedelta(seconds=37)),  # noqa
                (2, 'test_user_6', 2, parse('2015-10-12T03:05:00+00:00'),
                 parse('2015-10-12T03:07:00+00:00'), timedelta(minutes=2),
                 timedelta(seconds=38)),  # noqa
                (3, 'test_user_7', 0, parse('2015-10-12T03:07:00+00:00'),
                 parse('2015-10-12T04:00:00+00:00'), timedelta(minutes=53),
                 timedelta(seconds=0)),  # noqa
                (3, 'test_user_7', 1, parse('2015-10-12T04:00:00+00:00'),
                 parse('2015-10-12T04:02:00+00:00'), timedelta(minutes=2),
                 timedelta(seconds=36)),  # noqa
                (2, 'test_user_6', 3, parse('2015-10-12T04:02:00+00:00'),
                 parse('2015-10-12T04:03:00+00:00'), timedelta(minutes=1),
                 timedelta(seconds=35)),  # noqa
                (3, 'test_user_7', 2, parse('2015-10-12T04:03:00+00:00'),
                 parse('2015-10-12T04:13:00+00:00'), timedelta(minutes=10),
                 timedelta(seconds=38)),  # noqa
            ],
            columns=header)

        expected['start_datetime'] = (
            expected['start_datetime'].astype('datetime64[ns]'))
        expected['end_datetime'] = (
            expected['end_datetime'].astype('datetime64[ns]'))

        assert_frame_equal(returned[header], expected)
コード例 #8
0
    def test_task_timing(self):
        """
        Ensure that timing information is properly recorded across
        submissions/rejections/acceptances.
        """
        task = setup_task_history(self)

        self._verify_good_task_assignment_information(
            self.clients[6], {'task_id': task.id},
            task.project.short_description,
            'Submitted', 'Complete', False,
            True, {'test': 'test'}, self.workers[6],
            work_times_seconds=[36, 38, 35])

        self._verify_good_task_assignment_information(
            self.clients[7], {'task_id': task.id},
            task.project.short_description,
            'Submitted', 'Complete', True,
            True, {'test': 'test'}, self.workers[7],
            work_times_seconds=[36, 38])