Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
PIM
Itinerary
Commits
2a8bd6e0
Commit
2a8bd6e0
authored
Apr 13, 2022
by
Volker Krause
Browse files
Better auto transfer anchor time deltas
The previous ones were a bit too optimisitc in some cases.
parent
d6963e11
Pipeline
#166386
skipped
Changes
4
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
autotests/data/timeline/multi-traveler-merge-with-countryinfo.model
View file @
2a8bd6e0
...
...
@@ -40,7 +40,7 @@
"@value": "2000-01-01T13:00:00+01:00",
"timezone": "Europe/Berlin"
},
"anchorTimeDelta":
36
00,
"anchorTimeDelta":
54
00,
"floatingLocationType": "FavoriteLocation",
"from": {
"@type": "Location",
...
...
autotests/data/timeline/weather-forecast-with-tz-change.model
View file @
2a8bd6e0
...
...
@@ -152,7 +152,7 @@
"@value": "1996-10-16T17:50:00+02:00",
"timezone": "Europe/Berlin"
},
"anchorTimeDelta":
36
00,
"anchorTimeDelta":
54
00,
"floatingLocationType": "FavoriteLocation",
"from": {
"@type": "Location",
...
...
@@ -390,7 +390,7 @@
"@value": "1996-10-17T17:35:00+03:00",
"timezone": "Europe/Helsinki"
},
"anchorTimeDelta":
36
00,
"anchorTimeDelta":
54
00,
"floatingLocationType": "Reservation",
"from": {
"@type": "Location",
...
...
autotests/transfertest.cpp
View file @
2a8bd6e0
...
...
@@ -76,7 +76,7 @@ private Q_SLOTS:
auto
transfer
=
mgr
.
transfer
(
batchId
,
Transfer
::
Before
);
QCOMPARE
(
transfer
.
state
(),
Transfer
::
Pending
);
QCOMPARE
(
transfer
.
anchorTime
(),
QDateTime
({
2017
,
9
,
10
},
{
6
,
15
},
QTimeZone
(
"Europe/Berlin"
)));
QCOMPARE
(
transfer
.
anchorTimeDelta
(),
36
00
);
QCOMPARE
(
transfer
.
anchorTimeDelta
(),
54
00
);
QCOMPARE
(
transfer
.
alignment
(),
Transfer
::
Before
);
QCOMPARE
(
transfer
.
reservationId
(),
batchId
);
QVERIFY
(
transfer
.
from
().
hasCoordinate
());
...
...
src/app/transfermanager.cpp
View file @
2a8bd6e0
...
...
@@ -417,17 +417,32 @@ bool TransferManager::isNotInTripGroup(const QString &resId) const
return
m_tgMgr
->
tripGroupIdForReservation
(
resId
).
isEmpty
();
}
// default transfer anchor deltas (in minutes)
enum
{
FlightDelta
,
TrainDelta
,
BusDelta
,
FallbackDelta
};
static
constexpr
const
int
default_deltas
[][
2
]
=
{
{
90
,
30
},
// Flight
{
20
,
10
},
// Train
{
15
,
10
},
// Bus
{
30
,
15
},
// anything else
};
void
TransferManager
::
determineAnchorDeltaDefault
(
Transfer
&
transfer
,
const
QVariant
&
res
)
const
{
if
(
transfer
.
state
()
!=
Transfer
::
UndefinedState
)
{
return
;
}
int
delta
;
if
(
JsonLd
::
isA
<
FlightReservation
>
(
res
))
{
transfer
.
setAnchorTimeDelta
(
transfer
.
alignment
()
==
Transfer
::
Before
?
60
*
60
:
30
*
60
);
delta
=
default_deltas
[
FlightDelta
][
transfer
.
alignment
()];
}
else
if
(
JsonLd
::
isA
<
TrainReservation
>
(
res
))
{
delta
=
default_deltas
[
TrainDelta
][
transfer
.
alignment
()];
}
else
if
(
JsonLd
::
isA
<
BusReservation
>
(
res
))
{
delta
=
default_deltas
[
BusDelta
][
transfer
.
alignment
()];
}
else
{
transfer
.
setAnchorTimeDelta
(
10
*
60
)
;
delta
=
default_deltas
[
FallbackDelta
][
transfer
.
alignment
()]
;
}
transfer
.
setAnchorTimeDelta
(
delta
*
60
);
}
QDateTime
TransferManager
::
anchorTimeBefore
(
const
QString
&
resId
,
const
QVariant
&
res
)
const
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment