[pim/itinerary] src/app: Accumulate seat class information over all reservations in a batch

Volker Krause <[email protected]>
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit 00d35d2262639088171d4182ebaca1830e8db401 by Volker Krause.
Committed on 24/07/2026 at 11:46.
Pushed by vkrause into branch 'master'.

Accumulate seat class information over all reservations in a batch

Fixes class information not being shown if some elements in the batch
don't have that information for example.

M  +13   -0    src/app/TimelineDelegate.qml
M  +1    -1    src/app/TrainDelegate.qml

https://invent.kde.org/pim/itinerary/-/commit/00d35d2262639088171d4182ebaca1830e8db401

diff --git a/src/app/TimelineDelegate.qml b/src/app/TimelineDelegate.qml
index 8cd426c78..be71cd979 100644
--- a/src/app/TimelineDelegate.qml
+++ b/src/app/TimelineDelegate.qml
@@ -90,6 +90,19 @@ FormCard.FormCard {
         return [...new Set(s)].join(", ");
     }
 
+    readonly property string seatingType: {
+        let s = []
+        for (const resId of root.resIds) {
+            const res = ReservationManager.reservation(resId);
+            const seat = res?.reservedTicket?.ticketedSeat;
+            if (seat && seat.seatingType)
+                s.push(seat.seatingType);
+        }
+        if (s.length === 0)
+            return "-";
+        return [...new Set(s)].join(", ");
+    }
+
     FormCard.AbstractFormDelegate {
         id: content
         onClicked: root.clicked()
diff --git a/src/app/TrainDelegate.qml b/src/app/TrainDelegate.qml
index e90d25db4..cd1b593ef 100644
--- a/src/app/TrainDelegate.qml
+++ b/src/app/TrainDelegate.qml
@@ -72,7 +72,7 @@ TimelineDelegate {
                 }
                 TimelineDelegateSeatRowLabel {
                     text: {
-                        const s = root.reservation?.reservedTicket?.ticketedSeat?.seatingType;
+                        const s = root.seatingType;
                         return i18nc("train class", "Class: <b>%1</b>", s || "-");
                     }
                     lowPriority: true
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.