Skip to content

Commit

Permalink
More fallout from the old -> new change
Browse files Browse the repository at this point in the history
The coordinates stored are now a direct array and do not need to be converted
from a coordinate list
  • Loading branch information
shankari committed Jun 28, 2016
1 parent 17736b9 commit ff0c3bc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 15 deletions.
16 changes: 3 additions & 13 deletions emission/storage/decorations/common_place_queries.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,28 +42,18 @@ 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):
places_to_successors = {}
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:
Expand Down
4 changes: 2 additions & 2 deletions emission/storage/decorations/common_trip_queries.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down

0 comments on commit ff0c3bc

Please sign in to comment.