-
Notifications
You must be signed in to change notification settings - Fork 115
Better db #104
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Better db #104
Changes from all commits
6fb78d0
82f8130
7e590b4
0070879
f7438f4
c32acbb
a766f71
a70a371
9dfbaa0
fb8fa19
0d2eeb2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
--require spec_helper |
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,15 +2,26 @@ | |
<%= "Автобусы #{@from.name} – #{@to.name}" %> | ||
</h1> | ||
<h2> | ||
<%= "В расписании #{@trips.count} рейсов" %> | ||
<%= "В расписании #{@trips.load.size} рейсов" %> | ||
</h2> | ||
|
||
<% @trips.each do |trip| %> | ||
<ul> | ||
<%= render "trip", trip: trip %> | ||
<% if trip.bus.services.present? %> | ||
<%= render "services", services: trip.bus.services %> | ||
<li><%= "Отправление: #{trip.start_time.strftime('%H:%M')}" %></li> | ||
<li><%= "Прибытие: #{(trip.start_time + trip.duration_minutes.minutes).strftime('%H:%M')}" %></li> | ||
<li><%= "В пути: #{trip.duration_minutes / 60}ч. #{trip.duration_minutes % 60}мин." %></li> | ||
<li><%= "Цена: #{trip.price_cents / 100}р. #{trip.price_cents % 100}коп." %></li> | ||
<li><%= "Автобус: #{trip.bus.model} №#{trip.bus.number}" %></li> | ||
|
||
<% services = trip.bus.services %> | ||
<% if services.any? %> | ||
<li>Сервисы в автобусе:</li> | ||
<ul> | ||
<% services.each do |service| %> | ||
<li><%= "#{service.name}" %></li> | ||
<% end %> | ||
</ul> | ||
<% end %> | ||
</ul> | ||
<%= render "delimiter" %> | ||
==================================================== | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Можно не очень сильно проиграть по перформансу и сохранить удобство паршлов если юзать рендеринг коллекций. Там даже можно параметром задать шаблон spacer/delimiter: https://guides.rubyonrails.org/v7.0/action_view_overview.html#spacer-templates |
||
<% end %> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍