Deduplicate saved legs
This commit is contained in:
@@ -69,11 +69,14 @@ export class LegsDataStore {
|
||||
DataStore.set("legs", this.data);
|
||||
}
|
||||
|
||||
remember(trip_id, origin_id, destination_id) {
|
||||
remember(trip_id, origin_location_id, destination_location_id) {
|
||||
this.data = this.data.filter((leg) => {
|
||||
return !(leg.trip_id == trip_id && leg.origin_location_id == origin_location_id && leg.destination_location_id == destination_location_id);
|
||||
});
|
||||
this.data.push({
|
||||
trip_id: trip_id,
|
||||
origin_location_id: origin_id,
|
||||
destination_location_id: destination_id,
|
||||
origin_location_id: origin_location_id,
|
||||
destination_location_id: destination_location_id,
|
||||
});
|
||||
|
||||
this.write();
|
||||
|
Reference in New Issue
Block a user