Minor optimizations

This commit is contained in:
itskovacs 2025-08-06 21:05:16 +02:00
parent 550b7ac328
commit e5a44af210
2 changed files with 6 additions and 6 deletions

View File

@ -41,8 +41,8 @@ export class TripCreateModalComponent {
image_id: null, image_id: null,
}); });
if (this.config.data) { const patchValue = this.config.data?.trip;
let patchValue = this.config.data.trip; if (patchValue) {
if (!patchValue.image_id) delete patchValue["image"]; if (!patchValue.image_id) delete patchValue["image"];
this.tripForm.patchValue(patchValue); this.tripForm.patchValue(patchValue);
} }

View File

@ -43,9 +43,9 @@ export class TripPlaceSelectModalComponent {
}, },
}); });
if (this.config.data) { const places: Place[] | undefined = this.config.data?.places;
let places: Place[] = this.config.data.places; if (places) {
this.selectedPlaces.push(...places); this.selectedPlaces = [...places];
this.selectedPlacesID = places.map((p) => p.id); this.selectedPlacesID = places.map((p) => p.id);
} }
@ -56,7 +56,7 @@ export class TripPlaceSelectModalComponent {
return; return;
} }
let v = value.toLowerCase(); const v = value.toLowerCase();
this.displayedPlaces = this.places.filter( this.displayedPlaces = this.places.filter(
(p) => (p) =>
p.name.toLowerCase().includes(v) || p.name.toLowerCase().includes(v) ||