summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBirte Kristina Friesel <derf@finalrewind.org>2023-07-15 16:11:21 +0200
committerBirte Kristina Friesel <derf@finalrewind.org>2023-07-15 16:11:21 +0200
commitcdce746afd3c12021cefef612e9534b89e0e9623 (patch)
treee142a5ccde726d594f23b9ca1e115d3af1caa9bb
parentb446b68e673e433cd7d964defcb5f6f6e96584a4 (diff)
increase maximum comment length
-rwxr-xr-xlib/Travelynx.pm98
-rwxr-xr-xlib/Travelynx/Controller/Traveling.pm46
2 files changed, 72 insertions, 72 deletions
diff --git a/lib/Travelynx.pm b/lib/Travelynx.pm
index 42e1cd8..b69d619 100755
--- a/lib/Travelynx.pm
+++ b/lib/Travelynx.pm
@@ -123,10 +123,10 @@ sub startup {
before_dispatch => sub {
my ($self) = @_;
- # The "theme" cookie is set client-side if the theme we delivered was
- # changed by dark mode detection or by using the theme switcher. It's
- # not part of Mojolicious' session data (and can't be, due to
- # signing and HTTPOnly), so we need to add it here.
+ # The "theme" cookie is set client-side if the theme we delivered was
+ # changed by dark mode detection or by using the theme switcher. It's
+ # not part of Mojolicious' session data (and can't be, due to
+ # signing and HTTPOnly), so we need to add it here.
for my $cookie ( @{ $self->req->cookies } ) {
if ( $cookie->name eq 'theme' ) {
$self->session( theme => $cookie->value );
@@ -171,8 +171,8 @@ sub startup {
}
);
-# https://de.wikipedia.org/wiki/Liste_nach_Gemeinden_und_Regionen_benannter_IC/ICE-Fahrzeuge#Namensgebung_ICE-Triebz%C3%BCge_nach_Gemeinden
-# via https://github.com/marudor/bahn.expert/blob/main/src/server/coachSequence/TrainNames.ts
+ # https://de.wikipedia.org/wiki/Liste_nach_Gemeinden_und_Regionen_benannter_IC/ICE-Fahrzeuge#Namensgebung_ICE-Triebz%C3%BCge_nach_Gemeinden
+ # via https://github.com/marudor/bahn.expert/blob/main/src/server/coachSequence/TrainNames.ts
$self->attr(
ice_name => sub {
my $id_to_name = JSON->new->utf8->decode(
@@ -645,15 +645,15 @@ sub startup {
my $new_checkout_station_id = $status->{station_eva};
- # When a checkout is triggered by a checkin, there is an edge case
- # with related stations.
- # Assume a user travels from A to B1, then from B2 to C. B1 and B2 are
- # relatd stations (e.g. "Frankfurt Hbf" and "Frankfurt Hbf(tief)").
- # Now, if they check in for the journey from B2 to C, and have not yet
- # checked out of the previous train, $train is undef as B2 is not B1.
- # Redo the request with with_related => 1 to avoid this case.
- # While at it, we increase the lookahead to handle long journeys as
- # well.
+ # When a checkout is triggered by a checkin, there is an edge case
+ # with related stations.
+ # Assume a user travels from A to B1, then from B2 to C. B1 and B2 are
+ # relatd stations (e.g. "Frankfurt Hbf" and "Frankfurt Hbf(tief)").
+ # Now, if they check in for the journey from B2 to C, and have not yet
+ # checked out of the previous train, $train is undef as B2 is not B1.
+ # Redo the request with with_related => 1 to avoid this case.
+ # While at it, we increase the lookahead to handle long journeys as
+ # well.
if ( not $train ) {
$status = $self->iris->get_departures(
station => $station,
@@ -692,9 +692,9 @@ sub startup {
if ( not defined $train ) {
- # Arrival time via IRIS is unknown, so the train probably has not
- # arrived yet. Fall back to HAFAS.
- # TODO support cases where $station is EVA or DS100 code
+ # Arrival time via IRIS is unknown, so the train probably has not
+ # arrived yet. Fall back to HAFAS.
+ # TODO support cases where $station is EVA or DS100 code
if (
my $station_data
= List::Util::first { $_->[0] eq $station }
@@ -805,13 +805,13 @@ sub startup {
}
elsif ( defined $train and $train->arrival_is_cancelled ) {
- # This branch is only taken if the deparure was not cancelled,
- # i.e., if the train was supposed to go here but got
- # redirected or cancelled on the way and not from the start on.
- # If the departure itself was cancelled, the user route is
- # cancelled_from action -> 'cancelled journey' panel on main page
- # -> cancelled_to action -> force checkout (causing the
- # previous branch to be taken due to $force)
+ # This branch is only taken if the deparure was not cancelled,
+ # i.e., if the train was supposed to go here but got
+ # redirected or cancelled on the way and not from the start on.
+ # If the departure itself was cancelled, the user route is
+ # cancelled_from action -> 'cancelled journey' panel on main page
+ # -> cancelled_to action -> force checkout (causing the
+ # previous branch to be taken due to $force)
$journey->{cancelled} = 1;
$self->journeys->add_from_in_transit(
db => $db,
@@ -946,8 +946,8 @@ sub startup {
my $db = $self->pg->db;
-# TODO "with_timestamps" is misleading, there are more differences between in_transit and in_transit_str
-# Here it's only needed because of dep_eva / arr_eva names
+ # TODO "with_timestamps" is misleading, there are more differences between in_transit and in_transit_str
+ # Here it's only needed because of dep_eva / arr_eva names
my $in_transit = $self->in_transit->get(
db => $db,
uid => $uid,
@@ -982,19 +982,19 @@ sub startup {
my $suggestion ( @{ $trainsearch->{suggestions} // [] } )
{
- # Drunken API, sail with care. Both date formats are used interchangeably
+ # Drunken API, sail with care. Both date formats are used interchangeably
if (
$suggestion->{depDate}
and ( $suggestion->{depDate} eq $date_yy
or $suggestion->{depDate} eq $date_yyyy )
)
{
- # Train numbers are not unique, e.g. IC 149 refers both to the
- # InterCity service Amsterdam -> Berlin and to the InterCity service
- # Koebenhavns Lufthavn st -> Aarhus. One workaround is making
- # requests with the stationFilter=80 parameter. Checking the origin
- # station seems to be the more generic solution, so we do that
- # instead.
+ # Train numbers are not unique, e.g. IC 149 refers both to the
+ # InterCity service Amsterdam -> Berlin and to the InterCity service
+ # Koebenhavns Lufthavn st -> Aarhus. One workaround is making
+ # requests with the stationFilter=80 parameter. Checking the origin
+ # station seems to be the more generic solution, so we do that
+ # instead.
if ( $suggestion->{dep} eq $train->origin ) {
$result = $suggestion;
last;
@@ -1007,11 +1007,11 @@ sub startup {
return Mojo::Promise->reject("trainlink not found");
}
- # Calculate and store trip_id.
- # The trip_id's date part doesn't seem to matter -- so far,
- # HAFAS is happy as long as the date part starts with a number.
- # HAFAS-internal tripIDs use this format (withouth leading zero
- # for day of month < 10) though, so let's stick with it.
+ # Calculate and store trip_id.
+ # The trip_id's date part doesn't seem to matter -- so far,
+ # HAFAS is happy as long as the date part starts with a number.
+ # HAFAS-internal tripIDs use this format (withouth leading zero
+ # for day of month < 10) though, so let's stick with it.
my $date_map = $date_yyyy;
$date_map =~ tr{.}{}d;
my $trip_id = sprintf( '1|%d|%d|%d|%s',
@@ -1965,16 +1965,16 @@ sub startup {
next;
}
- # Manual journey entries are only included if one of the following
- # conditions is satisfied:
- # * their route has more than two elements (-> probably more than just
- # start and stop station), or
- # * $include_manual is true (-> user wants to see incomplete routes)
- # This avoids messing up the map in case an A -> B connection has been
- # tracked both with a regular checkin (-> detailed route shown on map)
- # and entered manually (-> beeline also shown on map, typically
- # significantly differs from detailed route) -- unless the user
- # sets include_manual, of course.
+ # Manual journey entries are only included if one of the following
+ # conditions is satisfied:
+ # * their route has more than two elements (-> probably more than just
+ # start and stop station), or
+ # * $include_manual is true (-> user wants to see incomplete routes)
+ # This avoids messing up the map in case an A -> B connection has been
+ # tracked both with a regular checkin (-> detailed route shown on map)
+ # and entered manually (-> beeline also shown on map, typically
+ # significantly differs from detailed route) -- unless the user
+ # sets include_manual, of course.
if ( $journey->{edited} & 0x0010
and @route <= 2
and not $include_manual )
diff --git a/lib/Travelynx/Controller/Traveling.pm b/lib/Travelynx/Controller/Traveling.pm
index 85c4e8a..f283762 100755
--- a/lib/Travelynx/Controller/Traveling.pm
+++ b/lib/Travelynx/Controller/Traveling.pm
@@ -123,21 +123,21 @@ sub get_connecting_trains_p {
next;
}
- # In general, this function is meant to return feasible
- # connections. However, cancelled connections may also be of
- # interest and are also useful for logging cancellations.
- # To satisfy both demands with (hopefully) little confusion and
- # UI clutter, this function returns two concatenated arrays:
- # actual connections (ordered by actual departure time) followed
- # by cancelled connections (ordered by scheduled departure time).
- # This is easiest to achieve in two separate loops.
- #
- # Note that a cancelled train may still have a matching destination
- # in its route_post, e.g. if it leaves out $eva due to
- # unscheduled route changes but continues on schedule afterwards
- # -- so it is only cancelled at $eva, not on the remainder of
- # the route. Also note that this specific case is not yet handled
- # properly by the cancellation logic etc.
+ # In general, this function is meant to return feasible
+ # connections. However, cancelled connections may also be of
+ # interest and are also useful for logging cancellations.
+ # To satisfy both demands with (hopefully) little confusion and
+ # UI clutter, this function returns two concatenated arrays:
+ # actual connections (ordered by actual departure time) followed
+ # by cancelled connections (ordered by scheduled departure time).
+ # This is easiest to achieve in two separate loops.
+ #
+ # Note that a cancelled train may still have a matching destination
+ # in its route_post, e.g. if it leaves out $eva due to
+ # unscheduled route changes but continues on schedule afterwards
+ # -- so it is only cancelled at $eva, not on the remainder of
+ # the route. Also note that this specific case is not yet handled
+ # properly by the cancellation logic etc.
if ( $train->departure_is_cancelled ) {
my @via = (
@@ -158,7 +158,7 @@ sub get_connecting_trains_p {
{
push( @results, [ $train, $dest ] );
- # Show all past and up to two future departures per destination
+ # Show all past and up to two future departures per destination
if ( not $train->departure
or $train->departure->epoch >= $now )
{
@@ -360,7 +360,7 @@ sub get_connecting_trains_p {
sub {
my ($err) = @_;
-# TODO logging. HAFAS errors should never happen, IRIS errors are noteworthy too.
+ # TODO logging. HAFAS errors should never happen, IRIS errors are noteworthy too.
$promise->reject($err);
return;
}
@@ -632,8 +632,8 @@ sub travel_action {
return;
}
- # Silently ignore errors -- if they are permanent, the user will see
- # them when selecting the destination manually.
+ # Silently ignore errors -- if they are permanent, the user will see
+ # them when selecting the destination manually.
my ( $still_checked_in, undef ) = $self->checkout(
station => $destination,
force => 0
@@ -1035,10 +1035,10 @@ sub commute {
$candidate_count{ $journey->{from_name} }++;
}
else {
- # Avoid selecting an intermediate station for multi-leg commutes.
- # Assumption: The intermediate station is also used for private
- # travels -> penalize stations which are used on weekends or at
- # unexpected times.
+ # Avoid selecting an intermediate station for multi-leg commutes.
+ # Assumption: The intermediate station is also used for private
+ # travels -> penalize stations which are used on weekends or at
+ # unexpected times.
$candidate_count{ $journey->{from_name} }--;
$candidate_count{ $journey->{to_name} }--;
}