🐛 Fix Trip days order

This commit is contained in:
itskovacs 2025-09-30 17:48:46 +02:00
parent 4b6d9a19a5
commit 24d85ea44c
3 changed files with 2 additions and 7 deletions

View File

@ -1 +1 @@
__version__ = "1.17.0" __version__ = "1.17.1"

View File

@ -260,7 +260,7 @@ class Trip(TripBase, table=True):
user: str = Field(foreign_key="user.username", ondelete="CASCADE") user: str = Field(foreign_key="user.username", ondelete="CASCADE")
places: list["Place"] = Relationship(back_populates="trips", link_model=TripPlaceLink) places: list["Place"] = Relationship(back_populates="trips", link_model=TripPlaceLink)
days: list["TripDay"] = Relationship(back_populates="trip", cascade_delete=True) days: list["TripDay"] = Relationship(back_populates="trip", sa_relationship_kwargs={"order_by": "TripDay.label"}, cascade_delete=True)
shares: list["TripShare"] = Relationship(back_populates="trip", cascade_delete=True) shares: list["TripShare"] = Relationship(back_populates="trip", cascade_delete=True)
packing_items: list["TripPackingListItem"] = Relationship(back_populates="trip", cascade_delete=True) packing_items: list["TripPackingListItem"] = Relationship(back_populates="trip", cascade_delete=True)
checklist_items: list["TripChecklistItem"] = Relationship(back_populates="trip", cascade_delete=True) checklist_items: list["TripChecklistItem"] = Relationship(back_populates="trip", cascade_delete=True)

View File

@ -363,10 +363,6 @@ export class TripComponent implements AfterViewInit {
}, 100); }, 100);
} }
sortTripDays() {
this.trip?.days.sort((a, b) => a.label.localeCompare(b.label));
}
toggleFiltering() { toggleFiltering() {
this.isFilteringMode = !this.isFilteringMode; this.isFilteringMode = !this.isFilteringMode;
if (!this.isFilteringMode) this.flattenTripDayItems(); if (!this.isFilteringMode) this.flattenTripDayItems();
@ -412,7 +408,6 @@ export class TripComponent implements AfterViewInit {
} }
flattenTripDayItems(searchValue?: string) { flattenTripDayItems(searchValue?: string) {
this.sortTripDays();
let prevLat: number, prevLng: number; let prevLat: number, prevLng: number;
this.flattenedTripItems = this.trip!.days.flatMap((day) => this.flattenedTripItems = this.trip!.days.flatMap((day) =>
[...day.items] [...day.items]