Unverified Commit aba72071 authored by Birte Kristina Friesel's avatar Birte Kristina Friesel
Browse files

sort full history in chronological order (ascending by time)

This feels more intuitive. The snippet on the landing page remains in
reverse chronological order (descending by time).
parent 3cdd41ad
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -1582,6 +1582,7 @@ sub yearly_history {
		uid           => $self->current_user->{id},
		after         => $interval_start,
		before        => $interval_end,
		sort          => 'asc',
		with_datetime => 1
	);

@@ -1664,6 +1665,7 @@ sub monthly_history {
		uid           => $self->current_user->{id},
		after         => $interval_start,
		before        => $interval_end,
		sort          => 'asc',
		with_datetime => 1
	);

+6 −1
Original line number Diff line number Diff line
@@ -698,9 +698,14 @@ sub get {
		user_id   => $uid,
		cancelled => 0
	);

	my $order_key = '-desc';
	if ( $opt{sort} and $opt{sort} eq 'asc' ) {
		$order_key = '-asc';
	}
	my %order = (
		order_by => {
			-desc => 'real_dep_ts',
			$order_key => 'real_dep_ts',
		}
	);

+23 −8
Original line number Diff line number Diff line
@@ -163,6 +163,20 @@ ul.route-history > li {
	}

	// route icon bubble
	&.order-asc {
		i.material-icons {
			&[aria-label=von] {
				display: block;
				transform: rotate(90deg);
				height: 1rem;
				margin-top: 0.4rem;
			}
			&[aria-label=nach] {
				padding-top: 0.4rem;
			}
		}
	}
	&.order-desc {
		i.material-icons {
			&[aria-label=nach] {
				padding-top: 0.4rem;
@@ -174,6 +188,7 @@ ul.route-history > li {
				margin-top: 0.4rem;
			}
		}
	}

	// route line / "perlenschnur"
	&::before {
+70 −35
Original line number Diff line number Diff line
@@ -27,10 +27,25 @@
					</span>
				</a>

				<ul class="route-history">
					<li>
				<ul class="route-history route-history-<%= stash('order') // q{} %>">
					% if (stash('order') and stash('order') eq 'asc') {
						<li class="order-asc">
							<i class="material-icons tiny" aria-label="von">play_circle_filled</i>
							<a href="<%= $detail_link %>" class="unmarked">
							% if (param('cancelled')) {
								%= $travel->{sched_departure}->strftime('%H:%M')
							% }
							% else {
								<%= $travel->{rt_departure}->strftime('%H:%M') %>
								% if ($travel->{delay_dep} and int($travel->{delay_dep} / 60)) {
									(<%= sprintf('%+d', $travel->{delay_dep} / 60) %>)
								% }
							% }
							<strong><%= $travel->{from_name} %></strong>
							</a>
						</li>
						<li class="order-asc">
							<i class="material-icons tiny" aria-label="nach">radio_button_unchecked</i>

							<a href="<%= $detail_link %>" class="unmarked">
							% if (param('cancelled') and $travel->{sched_arrival}->epoch != 0) {
								%= $travel->{sched_arrival}->strftime('%H:%M')
@@ -48,10 +63,29 @@
							<strong><%= $travel->{to_name} %></strong>
							</a>
						</li>

					<li>
					% }
					% else {
						<li class="order-desc">
							<i class="material-icons tiny" aria-label="nach">radio_button_unchecked</i>
							<a href="<%= $detail_link %>" class="unmarked">
							% if (param('cancelled') and $travel->{sched_arrival}->epoch != 0) {
								%= $travel->{sched_arrival}->strftime('%H:%M')
							% }
							% else {
								% if ($travel->{rt_arrival}->epoch == 0 and $travel->{sched_arrival}->epoch == 0) {
									<i class="material-icons">timer_off</i>
								% } else {
									%= $travel->{rt_arrival}->strftime('%H:%M');
									% if ($travel->{delay_arr} and int($travel->{delay_arr} / 60)) {
										(<%= sprintf('%+d', $travel->{delay_arr} / 60) %>)
									% }
								% }
							% }
							<strong><%= $travel->{to_name} %></strong>
							</a>
						</li>
						<li class="order-desc">
							<i class="material-icons tiny" aria-label="von">play_circle_filled</i>

							<a href="<%= $detail_link %>" class="unmarked">
							% if (param('cancelled')) {
								%= $travel->{sched_departure}->strftime('%H:%M')
@@ -65,6 +99,7 @@
							<strong><%= $travel->{from_name} %></strong>
							</a>
						</li>
					% }
				</ul>
			</li>
		% }
+1 −1
Original line number Diff line number Diff line
@@ -11,5 +11,5 @@
</div>

% if (stash('journeys')) {
	%= include '_history_trains', date_format => '%d.%m.', journeys => stash('journeys');
	%= include '_history_trains', date_format => '%d.%m.', journeys => stash('journeys'), order => 'asc';
% }
Loading