def presence_start_end(user_id=0):
    """
    Returns mean presence time of begin and end of work.
    """
    data = get_data()
    if user_id not in data:
        log.debug('User %s not found!', user_id)
        return []

    weekdays = group_by_weekday_with_points(data[user_id])

    result = [(calendar.day_abbr[weekday], mean(points[0]), mean(points[1]))
              for weekday, points in weekdays.items()]

    return result
 def test_group_by_weekday_with_points(self):
     """
     Test weekly grouped with points.
     """
     data = utils.get_data()
     sample_gbwp = utils.group_by_weekday_with_points(data[10])
     expected_gbwp = {
         0: [[], []],
         1: [[34745], [64792]],
         2: [[33592], [58057]],
         3: [[38926], [62631]],
         4: [[], []],
         5: [[], []],
         6: [[], []],
     }
     self.assertDictEqual(sample_gbwp, expected_gbwp)