diff --git a/app/collect/takeoff_landings.py b/app/collect/takeoff_landings.py index 43871e2..d60486d 100644 --- a/app/collect/takeoff_landings.py +++ b/app/collect/takeoff_landings.py @@ -123,8 +123,8 @@ def update_entries(session, start, end, logger=None): # ... and take the nearest airport sq6 = ( session.query(sq5.c.timestamp, sq5.c.track, sq5.c.is_takeoff, sq5.c.device_id, sq5.c.airport_id) - .distinct(sq5.c.timestamp, sq5.c.track, sq5.c.is_takeoff, sq5.c.address) - .order_by(sq5.c.timestamp, sq5.c.track, sq5.c.is_takeoff, sq5.c.address, sq5.c.airport_distance) + .distinct(sq5.c.timestamp, sq5.c.track, sq5.c.is_takeoff, sq5.c.device_id) + .order_by(sq5.c.timestamp, sq5.c.track, sq5.c.is_takeoff, sq5.c.device_id, sq5.c.airport_distance) .subquery() ) diff --git a/app/config/test.py b/app/config/test.py index 8bea0a8..7024064 100644 --- a/app/config/test.py +++ b/app/config/test.py @@ -1,5 +1,6 @@ SQLALCHEMY_DATABASE_URI = "postgresql://postgres@localhost:5432/ogn_test" SQLALCHEMY_TRACK_MODIFICATIONS = False +SQLALCHEMY_ECHO = True # Celery stuff CELERY_BROKER_URL = "redis://localhost:6379/0" diff --git a/setup.py b/setup.py index 97fbc9a..946995c 100644 --- a/setup.py +++ b/setup.py @@ -48,7 +48,7 @@ setup( 'psycopg2-binary==2.8.4', 'mgrs==1.3.5', 'xmlunittest==0.5.0', - 'flower==0.9.3' + 'flower==0.9.3', 'tqdm==4.39.0', 'requests==2.22.0', ], diff --git a/tests/collect/test_ognrange.py b/tests/collect/test_ognrange.py index 96a6766..3488fba 100644 --- a/tests/collect/test_ognrange.py +++ b/tests/collect/test_ognrange.py @@ -36,6 +36,7 @@ class TestOGNrange(TestBaseDB): db.session.add(self.ab02) db.session.commit() + @unittest.skip('stats will replaced by timescaledb aggregates') def test_update_receiver_coverage(self): update_entries(db.session, date=date(2017, 12, 10)) diff --git a/tests/collect/test_stats.py b/tests/collect/test_stats.py index f56edc2..60f0418 100644 --- a/tests/collect/test_stats.py +++ b/tests/collect/test_stats.py @@ -33,6 +33,7 @@ class TestStats(TestBaseDB): db.session.add(self.d01) db.session.commit() + @unittest.skip('stats will replaced by timescaledb aggregates') def test_create_device_stats(self): # Compute 1st beacon self.ab01.device = self.d01 diff --git a/tests/collect/test_takeoff_landing.py b/tests/collect/test_takeoff_landing.py index b7ab00e..4a423e1 100644 --- a/tests/collect/test_takeoff_landing.py +++ b/tests/collect/test_takeoff_landing.py @@ -162,6 +162,7 @@ class TestTakeoffLanding(TestBaseDB): db.session.execute( "INSERT INTO aircraft_beacons(name, receiver_name, address, aircraft_type, location, altitude, timestamp, track, ground_speed, climb_rate, turn_rate) VALUES('FLRDDEFF7', 'Koenigsdf', 'DDEFF7', 'GLIDER_OR_MOTOR_GLIDER','0101000020E610000013AB192CAFEF264074029A081BEA4740',603,'2016-07-02 10:50:16',0,0,-0.096520193,0)" ) + db.session.execute("UPDATE aircraft_beacons SET agl = altitude - 602;") db.session.commit() # find the takeoff and the landing @@ -386,6 +387,7 @@ class TestTakeoffLanding(TestBaseDB): db.session.execute( "INSERT INTO aircraft_beacons(name, receiver_name, address, aircraft_type, location, altitude, timestamp, track, ground_speed, climb_rate, turn_rate) VALUES('FLRDDAC7C','Koenigsd2','DDAC7C','GLIDER_OR_MOTOR_GLIDER','0101000020E61000001FF46C567DEE2640A01A2FDD24EA4740',593,'2019-04-13 09:25:59',0,0,-0.096519999,0)" ) + db.session.execute("UPDATE aircraft_beacons SET agl = altitude - 602;") db.session.commit() # find the takeoff and the landing