Пример #1
0
    def get_statistics(cls):
        # For now not using this to improve performance
        # response_values = [cls.get_approved_names_counter(),
        #                    cls.get_waiting_time_priority_queue(unit=UnitTime.HR.value),
        #                    cls.get_waiting_time_regular_queue(unit=UnitTime.DAY.value)]

        oldest_draft = Request.get_oldest_draft()
        todays_date = get_utc_now().date()
        submitted_date = oldest_draft.submittedDate.date()

        # note that busday_count does not count the end date provided
        delta = np.busday_count(submitted_date, todays_date)
        delta = int(delta)
        # add one to waiting time to account for specific scenarios
        if np.is_busday(todays_date) or delta == 0:
            delta += 1

        response_values = [
            0,
            0,  #cls.get_waiting_time_priority_queue(unit=UnitTime.HR.value),
            delta
        ]

        response = query_result_to_dict(response_keys, response_values)

        return response
Пример #2
0
    def get_statistics(cls):
        response_values = [cls.get_approved_names_counter(),
                           cls.get_waiting_time_priority_queue(unit=UnitTime.HR.value),
                           cls.get_waiting_time_regular_queue(unit=UnitTime.DAY.value)]

        response = query_result_to_dict(response_keys, response_values)

        return response
Пример #3
0
    def get_statistics(cls):
        # For now not using this to improve performance
        # response_values = [cls.get_approved_names_counter(),
        #                    cls.get_waiting_time_priority_queue(unit=UnitTime.HR.value),
        #                    cls.get_waiting_time_regular_queue(unit=UnitTime.DAY.value)]

        oldest_draft = Request.get_oldest_draft()
        todays_date = datetime.utcnow().date()
        submitted_date = oldest_draft.submittedDate.date()
        # add one to waiting time to account for current day
        delta = todays_date - submitted_date + 1

        response_values = [0,
                           0, #cls.get_waiting_time_priority_queue(unit=UnitTime.HR.value),
                           delta.days]

        response = query_result_to_dict(response_keys, response_values)

        return response