Commit d9d3aac7 authored by Birte Kristina Friesel's avatar Birte Kristina Friesel
Browse files

allow checkin from connections view

parent 7960114f
Loading
Loading
Loading
Loading
+14 −5
Original line number Diff line number Diff line
@@ -175,6 +175,12 @@ sub startup {
		}
	);

	$self->helper(
		'now' => sub {
			return DateTime->now( time_zone => 'Europe/Berlin' );
		}
	);

	$self->helper(
		'numify_skipped_stations' => sub {
			my ( $self, $count ) = @_;
@@ -1489,7 +1495,7 @@ sub startup {
			my $uid       = $opt{uid} // $self->current_user->{id};
			my $threshold = $opt{threshold}
			  // DateTime->now( time_zone => 'Europe/Berlin' )
			  ->subtract( weeks => 60 );
			  ->subtract( weeks => 6 );
			my $db = $opt{db} // $self->pg->db;

			my $journey = $db->select( 'in_transit', ['checkout_station_id'],
@@ -1504,7 +1510,7 @@ sub startup {
					},
					{
						limit    => 1,
						order_by => { -desc => 'real_dep_ts' }
						order_by => { -desc => 'real_departure' }
					}
				)->hash;
			}
@@ -1547,11 +1553,14 @@ sub startup {
			}

			my @destinations = $self->get_connection_targets(%opt);
			my $stationboard
			  = $self->get_departures( $status->{arr_ds100}, 0, 60 );

			@destinations = grep { $_ ne $status->{dep_name} } @destinations;

			if ( not @destinations ) {
				return;
			}

			my $stationboard
			  = $self->get_departures( $status->{arr_ds100}, 0, 60 );
			if ( $stationboard->{errstr} ) {
				return;
			}
+15 −1
Original line number Diff line number Diff line
@@ -145,6 +145,7 @@ sub log_action {

		my ( $train, $error )
		  = $self->checkin( $params->{station}, $params->{train} );
		my $destination = $params->{dest};

		if ($error) {
			$self->render(
@@ -154,7 +155,7 @@ sub log_action {
				},
			);
		}
		else {
		elsif ( not $destination ) {
			$self->render(
				json => {
					success     => 1,
@@ -162,6 +163,19 @@ sub log_action {
				},
			);
		}
		else {
			# Silently ignore errors -- if they are permanent, the user will see
			# them when selecting the destination manually.
			my ( $still_checked_in, undef )
			  = $self->checkout( $destination, 0 );
			my $station_link = '/s/' . $destination;
			$self->render(
				json => {
					success     => 1,
					redirect_to => $still_checked_in ? '/' : $station_link,
				},
			);
		}
	}
	elsif ( $params->{action} eq 'checkout' ) {
		my ( $still_checked_in, $error )
+13 −13
Original line number Diff line number Diff line
const CACHE_NAME = 'static-cache-v23';
const CACHE_NAME = 'static-cache-v24';
const FILES_TO_CACHE = [
  '/favicon.ico',
  '/offline.html',
  '/static/v23/css/light.min.css',
  '/static/v23/css/dark.min.css',
  '/static/v23/css/material-icons.css',
  '/static/v23/css/local.css',
  '/static/v23/fonts/MaterialIcons-Regular.woff2',
  '/static/v23/fonts/MaterialIcons-Regular.woff',
  '/static/v23/fonts/MaterialIcons-Regular.ttf',
  '/static/v23/js/jquery-3.4.1.min.js',
  '/static/v23/js/materialize.min.js',
  '/static/v23/js/travelynx-actions.min.js',
  '/static/v23/js/autocomplete.min.js',
  '/static/v23/js/geolocation.min.js',
  '/static/v24/css/light.min.css',
  '/static/v24/css/dark.min.css',
  '/static/v24/css/material-icons.css',
  '/static/v24/css/local.css',
  '/static/v24/fonts/MaterialIcons-Regular.woff2',
  '/static/v24/fonts/MaterialIcons-Regular.woff',
  '/static/v24/fonts/MaterialIcons-Regular.ttf',
  '/static/v24/js/jquery-3.4.1.min.js',
  '/static/v24/js/materialize.min.js',
  '/static/v24/js/travelynx-actions.min.js',
  '/static/v24/js/autocomplete.min.js',
  '/static/v24/js/geolocation.min.js',
];

self.addEventListener('install', (evt) => {
+4 −4
Original line number Diff line number Diff line
@@ -2,12 +2,12 @@
  font-family: 'Material Icons';
  font-style: normal;
  font-weight: 400;
  src: url(/static/v23/fonts/MaterialIcons-Regular.eot); /* For IE6-8 */
  src: url(/static/v24/fonts/MaterialIcons-Regular.eot); /* For IE6-8 */
  src: local('Material Icons'),
       local('MaterialIcons-Regular'),
       url(/static/v23/fonts/MaterialIcons-Regular.woff2) format('woff2'),
       url(/static/v23/fonts/MaterialIcons-Regular.woff) format('woff'),
       url(/static/v23/fonts/MaterialIcons-Regular.ttf) format('truetype');
       url(/static/v24/fonts/MaterialIcons-Regular.woff2) format('woff2'),
       url(/static/v24/fonts/MaterialIcons-Regular.woff) format('woff'),
       url(/static/v24/fonts/MaterialIcons-Regular.ttf) format('truetype');
}

.material-icons {
+1 −0
Original line number Diff line number Diff line
@@ -84,6 +84,7 @@ function tvly_reg_handlers() {
			action: 'checkin',
			station: link.data('station'),
			train: link.data('train'),
			dest: link.data('dest'),
		};
		tvly_run(link, req);
	});
Loading