Commit c8ad4c0a authored by Volker Krause's avatar Volker Krause
Browse files

Use the new plural form for finding calendar events

This allows us to find all elements of a multi-leg trip if we received
a minimal cancellation elements for all of them.
parent f041c62c
......@@ -100,17 +100,20 @@ QVector<ItineraryMemento::TripData> ItineraryMemento::data()
resolvedEvents.reserve(postProcResult.size());
const auto calendar = CalendarSupport::calendarSingleton(!qEnvironmentVariableIsSet("BPF_ITINERARY_TESTMODE"));
for (const auto &r : qAsConst(postProcResult)) {
auto e = std::make_pair(r, CalendarHandler::findEvent(calendar, r));
if (e.second) {
const auto existingRes = CalendarHandler::reservationsForEvent(e.second);
const auto events = CalendarHandler::findEvents(calendar, r);
if (events.empty()) {
resolvedEvents.push_back(std::make_pair(r, KCalendarCore::Event::Ptr()));
continue;
}
for (const auto &event : events) {
const auto existingRes = CalendarHandler::reservationsForEvent(event);
for (const auto &ev : existingRes) {
if (MergeUtil::isSame(ev, e.first)) {
e.first = MergeUtil::merge(ev, e.first);
break;
if (MergeUtil::isSame(ev, r)) {
resolvedEvents.push_back(std::make_pair(MergeUtil::merge(ev, r), event));
}
}
}
resolvedEvents.push_back(e);
}
// discard elemnents we couldn't complete from the calendar
......
Markdown is supported
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