def next_time_range(self): """ Calculates next missing range of data """ if self.request_couter > 0 and TimeRange.table_empty(self.cur): return None if self.request_couter == 0: if Track.table_empty(self.cur): timestamp_from = 0 else: timestamp_from = Track.latest(self.cur).timestamp return (timestamp_from, self._utc_timestamp_now()) latest = TimeRange.latest(self.cur) return latest.timestamp_from, latest.timestamp_to