From ff0c3bc4221b157a124711d144f01397bc098fc2 Mon Sep 17 00:00:00 2001 From: "K. Shankari" Date: Tue, 28 Jun 2016 01:11:37 -0700 Subject: [PATCH] More fallout from the old -> new change The coordinates stored are now a direct array and do not need to be converted from a coordinate list --- .../storage/decorations/common_place_queries.py | 16 +++------------- .../storage/decorations/common_trip_queries.py | 4 ++-- 2 files changed, 5 insertions(+), 15 deletions(-) diff --git a/emission/storage/decorations/common_place_queries.py b/emission/storage/decorations/common_place_queries.py index b0798633c..95736e109 100644 --- a/emission/storage/decorations/common_place_queries.py +++ b/emission/storage/decorations/common_place_queries.py @@ -42,17 +42,6 @@ def clear_existing_places(user_id): db = edb.get_common_place_db() db.remove({'user_id': user_id}) -def get_all_place_objs(common_place): - trip.trips = [unc_trip.get_id() for unc_trip in dct["sections"]] - place_db = edb.get_place_db() - start_places = [] - end_places = [] - for t in trip.trips: - start = place_db.find_one({"_id" : t.start_place}) - end = place_db.find_one({"_id" : t.end_place}) - start_places.append(start) - end_places.append(end) - ################################################################################ def create_places(list_of_cluster_data, user_id): @@ -60,10 +49,11 @@ def create_places(list_of_cluster_data, user_id): places_dct = {} logging.debug("About to create places for %d clusters" % len(list_of_cluster_data)) for dct in list_of_cluster_data: + logging.debug("Current coords = %s" % dct) start_name = dct['start'] end_name = dct['end'] - start_loc = gj.Point(dct['start_coords'].coordinate_list()) - end_loc = gj.Point(dct['end_coords'].coordinate_list()) + start_loc = gj.Point(dct['start_coords']) + end_loc = gj.Point(dct['end_coords']) start_loc_str = gj.dumps(start_loc, sort_keys=True) end_loc_str = gj.dumps(end_loc, sort_keys=True) if start_loc_str not in places_to_successors: diff --git a/emission/storage/decorations/common_trip_queries.py b/emission/storage/decorations/common_trip_queries.py index 32eb3f56a..6b5d08ec0 100644 --- a/emission/storage/decorations/common_trip_queries.py +++ b/emission/storage/decorations/common_trip_queries.py @@ -103,8 +103,8 @@ def set_up_trips(list_of_cluster_data, user_id): for dct in list_of_cluster_data: start_times = [] durations = [] - start_loc = gj.Point(dct['start_coords'].coordinate_list()) - end_loc = gj.Point(dct['end_coords'].coordinate_list()) + start_loc = gj.Point(dct['start_coords']) + end_loc = gj.Point(dct['end_coords']) start_place_id = esdcpq.get_common_place_at_location(start_loc).get_id() end_place_id = esdcpq.get_common_place_at_location(end_loc).get_id() #print 'dct["sections"].trip_id %s is' % dct["sections"][0]