Commit 605bab7f authored by Volker Krause's avatar Volker Krause
Browse files

Add merging rules for boat/ferry trips

parent b1b669cd
Pipeline #209144 passed with stage
in 9 minutes and 3 seconds
......@@ -11,6 +11,7 @@
#include "stringutil.h"
#include "sortutil.h"
#include <KItinerary/BoatTrip>
#include <KItinerary/BusTrip>
#include <KItinerary/Event>
#include <KItinerary/Flight>
......@@ -68,6 +69,7 @@ static bool prefixConflictIfPresent(const T &lhs, const T &rhs)
static bool isSameFlight(const Flight &lhs, const Flight &rhs);
static bool isSameTrainTrip(const TrainTrip &lhs, const TrainTrip &rhs);
static bool isSameBusTrip(const BusTrip &lhs, const BusTrip &rhs);
static bool isSameBoatTrip(const BoatTrip &lhs, const BoatTrip &rhs);
static bool isSameLodingBusiness(const LodgingBusiness &lhs, const LodgingBusiness &rhs);
static bool isSameFoodEstablishment(const FoodEstablishment &lhs, const FoodEstablishment &rhs);
static bool isSameTouristAttractionVisit(const TouristAttractionVisit &lhs, const TouristAttractionVisit &rhs);
......@@ -177,6 +179,21 @@ bool MergeUtil::isSame(const QVariant& lhs, const QVariant& rhs)
return isSameBusTrip(lhsTrip, rhsTrip);
// boat
if (JsonLd::isA<BoatReservation>(lhs)) {
const auto lhsRes = lhs.value<BoatReservation>();
const auto rhsRes = rhs.value<BoatReservation>();
if (lhsRes.reservationNumber() != rhsRes.reservationNumber()) {
return false;
return isSame(lhsRes.reservationFor(), rhsRes.reservationFor());
if (JsonLd::isA<BoatTrip>(lhs)) {
const auto lhsTrip = lhs.value<BoatTrip>();
const auto rhsTrip = rhs.value<BoatTrip>();
return isSameBoatTrip(lhsTrip, rhsTrip);
// hotel: booking ref, checkin day, name match
if (JsonLd::isA<LodgingReservation>(lhs)) {
const auto lhsRes = lhs.value<LodgingReservation>();
......@@ -391,6 +408,13 @@ static bool isSameBusTrip(const BusTrip &lhs, const BusTrip &rhs)
return lhs.busName() == rhs.busName() && lhs.busNumber() == rhs.busNumber() && lhs.departureTime() == rhs.departureTime();
static bool isSameBoatTrip(const BoatTrip& lhs, const BoatTrip& rhs)
return lhs.departureTime() == rhs.departureTime()
&& LocationUtil::isSameLocation(lhs.departureBoatTerminal(), rhs.departureBoatTerminal())
&& LocationUtil::isSameLocation(lhs.arrivalBoatTerminal(), rhs.arrivalBoatTerminal());
static bool isSameLodingBusiness(const LodgingBusiness &lhs, const LodgingBusiness &rhs)
if ( || {
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment