Skip to content
Open

A1 #270

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ GEM
digest
net-protocol
timeout
nio4r (2.5.8)
nio4r (2.7.3)
nokogiri (1.13.8-arm64-darwin)
racc (~> 1.4)
nokogiri (1.13.8-x86_64-linux)
Expand Down Expand Up @@ -223,6 +223,7 @@ GEM

PLATFORMS
arm64-darwin-20
arm64-darwin-23
x86_64-linux

DEPENDENCIES
Expand Down
5 changes: 5 additions & 0 deletions app/views/stations/_row.html.erb
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
<div class="record-row <%= cycle "odd", "even", name: "row-cycler" %> flexbox vertical stretch">
<%= station.identifier %>: <%= station.name %> (<%= station.address %>)
<br>Number of docked bikes: <%= station.docked_bikes.count %> </br>
Docked bikes:
<% station.docked_bikes.each do |bike| %>
<br><%= bike.identifier %>
<%end %>
</div>
2 changes: 1 addition & 1 deletion app/views/stations/index.html.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<div class="page-section flexbox vertical stretch">
<div class="section-inner flexbox vertical stretch">
<div class="section-title">
Welcome to ValetBike!
Welcome to ValetBike (Molly's Version)!
</div>
<div class="flexbox vertical stretch">
<% if @stations.present? %>
Expand Down
13 changes: 13 additions & 0 deletions lib/tasks/setup.rake
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
require 'csv'

desc "import stations and bike data"
task import: [:environment] do
CSV.foreach(('./notes/station-data.csv'), headers: true, col_sep: ",") do |row|
station = Station.new(identifier: row[0], name: row[1], address: row[6])
station.save!
end
CSV.foreach(('./notes/bike-data.csv'), headers: true, col_sep: ",") do |row|
bike = Bike.new(identifier: row[0], current_station: Station.find_by(identifier: row[1]))
bike.save!
end
end