1
0
mirror of https://github.com/fspc/bike-database.git synced 2025-02-23 01:23:24 -05:00

lk | moves notes, adds backup instructions, and shows asignees of bikes on bike page when they're present

This commit is contained in:
Louis Knapp 2017-05-01 17:14:53 -05:00
parent f656c1af87
commit fa2c2ede08
5 changed files with 32 additions and 0 deletions

View File

@ -16,6 +16,7 @@ class BikesController < ApplicationController
def edit def edit
@next_bike = Bike.where(log_number: @bike.log_number + 1).first @next_bike = Bike.where(log_number: @bike.log_number + 1).first
@previous_bike = Bike.where(log_number: @bike.log_number - 1).first @previous_bike = Bike.where(log_number: @bike.log_number - 1).first
@client = @bike.client
end end
def print_select def print_select

View File

@ -4,6 +4,12 @@
%h1 Edit bike %h1 Edit bike
.col-sm-3.col-sm-offset-3 .col-sm-3.col-sm-offset-3
=button_to "Mark as sold", {action: "mark_as_sold", id: @bike.id}, method: :patch, class: "btn btn-default", disabled: @bike.sold? =button_to "Mark as sold", {action: "mark_as_sold", id: @bike.id}, method: :patch, class: "btn btn-default", disabled: @bike.sold?
- if @client
.row
.col-sm-12
%h4
%span Assigned To
= link_to @client.name, edit_client_path(@client)
= render 'edit_form' = render 'edit_form'
.bottom-nav-links .bottom-nav-links
- if @previous_bike - if @previous_bike

13
docs/db_backups.md Normal file
View File

@ -0,0 +1,13 @@
To get the dump from a deployed environment:
First, create a backup:
heroku pg:backups:capture --app [app name]
Then, download the backup:
heroku pg:backups:download [backup id] --app [app name]
Then, reset the local database:
rake db:drop db:create db:migrate
Then, load the backup into the database:
pg_restore --verbose --clean --no-acl --no-owner -h localhost -U [username] -d [database name] latest.dump

View File

@ -6,6 +6,9 @@
- reports are broken - reports are broken
- bike receipts dont fit well - margins are too big and explanatory text - bike receipts dont fit well - margins are too big and explanatory text
too small too small
- flash message after a bike is logged should include the bike log
number
- unique index on log number for bikes
- Use hyphens for dates instead of backslashes - Use hyphens for dates instead of backslashes
- Autopopulate fields like model, brand, color based on what exists in - Autopopulate fields like model, brand, color based on what exists in
db db

View File

@ -54,6 +54,15 @@ describe BikesController do
expect(assigns(:bike)).to eq(@current_bike) expect(assigns(:bike)).to eq(@current_bike)
expect(assigns(:next_bike)).to eq(@next_bike) expect(assigns(:next_bike)).to eq(@next_bike)
end end
it "assigns a client if there is one" do
@client = create :client, bike: @current_bike
get :edit, id: @current_bike.id
expect(assigns(:client)).to eq(@client)
end
it "does not assign a client if there is none" do
get :edit, id: @current_bike.id
expect(assigns(:client)).to be_nil
end
end end
describe "#update" do describe "#update" do