diff --git a/Gemfile.lock b/Gemfile.lock index c3e104938..2266cf9c5 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -135,6 +135,8 @@ GEM nio4r (2.5.8) nokogiri (1.13.8-arm64-darwin) racc (~> 1.4) + nokogiri (1.13.8-x86_64-darwin) + racc (~> 1.4) nokogiri (1.13.8-x86_64-linux) racc (~> 1.4) public_suffix (5.0.0) @@ -194,6 +196,8 @@ GEM strscan (3.0.4) tailwindcss-rails (2.0.12-arm64-darwin) railties (>= 6.0.0) + tailwindcss-rails (2.0.12-x86_64-darwin) + railties (>= 6.0.0) tailwindcss-rails (2.0.12-x86_64-linux) railties (>= 6.0.0) thor (1.2.1) @@ -223,6 +227,7 @@ GEM PLATFORMS arm64-darwin-20 + x86_64-darwin-23 x86_64-linux DEPENDENCIES diff --git a/app/views/stations/_row.html.erb b/app/views/stations/_row.html.erb index 68a74d983..ef22b8a56 100644 --- a/app/views/stations/_row.html.erb +++ b/app/views/stations/_row.html.erb @@ -1,3 +1,14 @@
flexbox vertical stretch"> - <%= station.identifier %>: <%= station.name %> (<%= station.address %>) + <%= station.identifier %>: <%= station.name %> (<%= station.address %>) | Bike Count: <%= station.docked_bikes.count %> | Docked Bikes: + <% if station.docked_bikes.count == 0 %> + None + <% else %> + <% station.docked_bikes.each do |bike| %> + <% if bike == station.docked_bikes.last %> + <%= bike.identifier %> + <% else %> + <%= bike.identifier %>, + <% end %> + <% end %> + <% end %>
\ No newline at end of file diff --git a/app/views/stations/index.html.erb b/app/views/stations/index.html.erb index d211dda42..53d55b051 100644 --- a/app/views/stations/index.html.erb +++ b/app/views/stations/index.html.erb @@ -1,7 +1,7 @@
- Welcome to ValetBike! + Welcome to Emma's ValetBike!
<% if @stations.present? %> diff --git a/lib/tasks/setup.rake b/lib/tasks/setup.rake new file mode 100644 index 000000000..b5eca8ad0 --- /dev/null +++ b/lib/tasks/setup.rake @@ -0,0 +1,13 @@ +require 'csv' + +desc "Imports a CSV file with station and bike data" +task init_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 \ No newline at end of file