def get_pending(self, imsi, is_roaming): traffic = self._traffics[is_roaming] device = self.__get_device(imsi) billing_day = self.__get_billing_day(imsi) emtraffic.set_invoice_day(billing_day) traffic.set_device(device) return traffic.get_pending_traffic_history()
def get_history(self, imsi, is_roaming): traffic = self._traffics[is_roaming] tag = self.__get_tag(is_roaming) device = self.__get_device(imsi) billing_day = self.__get_billing_day(imsi) emtraffic.set_invoice_day(billing_day) traffic.set_device(device) return emtraffic.get_traffic_history(tag, device)
def update(self, imsi, sent_delta, recv_delta, is_roaming, suggest_sync = False): traffic = self._traffics[is_roaming] device = self.__get_device(imsi) billing_day = self.__get_billing_day(imsi) perform_sync = False self._num_updates += 1 if suggest_sync or (self._num_updates == SYNC_EVERY_N_UPDATES): perform_sync = True self._num_updates = 0 emtraffic.set_invoice_day(billing_day) traffic.set_device(device) traffic.process_history_traffic(sent_delta, recv_delta, \ int(os.times()[4] * 1000.0), perform_sync)
def update(self, imsi, sent_delta, recv_delta, is_roaming, suggest_sync=False): traffic = self._traffics[is_roaming] device = self.__get_device(imsi) billing_day = self.__get_billing_day(imsi) perform_sync = False self._num_updates += 1 if suggest_sync or (self._num_updates == SYNC_EVERY_N_UPDATES): perform_sync = True self._num_updates = 0 emtraffic.set_invoice_day(billing_day) traffic.set_device(device) traffic.process_history_traffic(sent_delta, recv_delta, \ int(os.times()[4] * 1000.0), perform_sync)