Deduplicate saved legs
This commit is contained in:
@@ -69,11 +69,14 @@ export class LegsDataStore {
|
|||||||
DataStore.set("legs", this.data);
|
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({
|
this.data.push({
|
||||||
trip_id: trip_id,
|
trip_id: trip_id,
|
||||||
origin_location_id: origin_id,
|
origin_location_id: origin_location_id,
|
||||||
destination_location_id: destination_id,
|
destination_location_id: destination_location_id,
|
||||||
});
|
});
|
||||||
|
|
||||||
this.write();
|
this.write();
|
||||||
|
Reference in New Issue
Block a user