Skip to content
Snippets Groups Projects
Unverified Commit e8c2fb54 authored by Dashie's avatar Dashie
Browse files

py3: None checking

parent ec263ee0
No related branches found
No related tags found
No related merge requests found
import logging
from twisted.python import log
import psycopg2
import psycopg2.extras
from collections import deque
import json
import re
import aprslib
import datetime
......@@ -17,7 +14,6 @@ from trackdirect.collector.PacketBatchInserter import PacketBatchInserter
from trackdirect.exceptions.TrackDirectParseError import TrackDirectParseError
from trackdirect.database.DatabaseConnection import DatabaseConnection
from trackdirect.repositories.StationRepository import StationRepository
from trackdirect.objects.Packet import Packet
#from pympler.tracker import SummaryTracker
......@@ -261,9 +257,10 @@ class TrackDirectDataCollector():
if (turnRate > 0) :
frequencyLimitToApply = int(frequencyLimitToApply / (1+turnRate))
if ((packet.timestamp - frequencyLimitToApply) < packet.markerPrevPacketTimestamp):
# This station is sending faster than config limit
return True
if packet.markerPrevPacketTimestamp:
if ((packet.timestamp - frequencyLimitToApply) < packet.markerPrevPacketTimestamp):
# This station is sending faster than config limit
return True
if (packet.stationId in self.movingStationIdsWithVisiblePacket):
# This station is sending way to fast (we havn't even added the previous packet to database yet)
......
import json
import datetime
import time
from trackdirect.parser.policies.MapSectorPolicy import MapSectorPolicy
......@@ -65,7 +63,7 @@ class PacketRelatedMapSectorsPolicy():
# We only add related map-sectors to moving stations (that has a marker)
if (packet.mapId == 1):
# If new packet is not confirmed (mapId 7) we connect it with related map-sectors later
if (previousPacket.markerCounter > 1
if (previousPacket.markerCounter is not None and previousPacket.markerCounter > 1
or packet.markerId == previousPacket.markerId):
# We only add related map-sectors if previous packet has a marker with several connected packet
# A packet with a marker that is not shared with anyone will be converted to a ghost-marker in client
......
import datetime
import time
import calendar
import collections
from trackdirect.common.Repository import Repository
from trackdirect.objects.Packet import Packet
......@@ -407,7 +403,7 @@ class PacketRepository(Repository):
record = selectCursor.fetchone()
selectCursor.close()
if (record is not None and record["latest_confirmed_packet_timestamp"] >= minTimestamp):
if (record is not None and record["latest_confirmed_packet_timestamp"] is not None and record["latest_confirmed_packet_timestamp"] >= minTimestamp):
return self.getObjectByIdAndTimestamp(record["latest_confirmed_packet_id"], record["latest_confirmed_packet_timestamp"])
else:
return self.create()
......@@ -431,7 +427,7 @@ class PacketRepository(Repository):
record = selectCursor.fetchone()
selectCursor.close()
if (record is not None and record["latest_location_packet_timestamp"] >= minTimestamp):
if (record is not None and record["latest_location_packet_timestamp"] is not None and record["latest_location_packet_timestamp"] >= minTimestamp):
return self.getObjectByIdAndTimestamp(record["latest_location_packet_id"], record["latest_location_packet_timestamp"])
else:
return self.create()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment