mirror of
				https://github.com/fspc/bike-database.git
				synced 2025-11-03 16:45:35 -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:
		
							parent
							
								
									f656c1af87
								
							
						
					
					
						commit
						fa2c2ede08
					
				@ -16,6 +16,7 @@ class BikesController < ApplicationController
 | 
			
		||||
  def edit
 | 
			
		||||
    @next_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
 | 
			
		||||
 | 
			
		||||
  def print_select
 | 
			
		||||
 | 
			
		||||
@ -4,6 +4,12 @@
 | 
			
		||||
      %h1 Edit bike
 | 
			
		||||
    .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?
 | 
			
		||||
  - if @client
 | 
			
		||||
    .row
 | 
			
		||||
      .col-sm-12
 | 
			
		||||
        %h4
 | 
			
		||||
          %span Assigned To
 | 
			
		||||
          = link_to @client.name, edit_client_path(@client)
 | 
			
		||||
  = render 'edit_form'
 | 
			
		||||
  .bottom-nav-links
 | 
			
		||||
    - if @previous_bike
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										13
									
								
								docs/db_backups.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								docs/db_backups.md
									
									
									
									
									
										Normal 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
 | 
			
		||||
@ -6,6 +6,9 @@
 | 
			
		||||
- reports are broken
 | 
			
		||||
- bike receipts dont fit well - margins are too big and explanatory text
 | 
			
		||||
  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
 | 
			
		||||
- Autopopulate fields like model, brand, color based on what exists in
 | 
			
		||||
  db
 | 
			
		||||
@ -54,6 +54,15 @@ describe BikesController do
 | 
			
		||||
      expect(assigns(:bike)).to eq(@current_bike)
 | 
			
		||||
      expect(assigns(:next_bike)).to eq(@next_bike)
 | 
			
		||||
    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
 | 
			
		||||
 | 
			
		||||
  describe "#update" do
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user