Skip to content
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

Carrie Walsh - LaughTracks #69

Open
wants to merge 79 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
79 commits
Select commit Hold shift + click to select a range
d60b598
Fixes typos in README
carriewalsh Mar 11, 2019
c0d1a90
Changes comedian/special to bourbon/award
carriewalsh Mar 13, 2019
23ded0b
Merge pull request #1 from carriewalsh/bourbon
carriewalsh Mar 13, 2019
949ddda
Adds initial html for main without ruby
carriewalsh Mar 13, 2019
218e7b8
Adds initial css for main
carriewalsh Mar 13, 2019
a565d49
Adds head to index
carriewalsh Mar 13, 2019
0faef10
Rearranges css for convention
carriewalsh Mar 13, 2019
400407c
Merge pull request #2 from carriewalsh/1views
carriewalsh Mar 13, 2019
cb70b99
Adds basic erb to dashboard
carriewalsh Mar 13, 2019
20065bc
Adds alt to image tags for accessibility
carriewalsh Mar 13, 2019
59cae4b
Adds a little more commented out logic for future erb
carriewalsh Mar 13, 2019
cc6f33a
Merge pull request #3 from carriewalsh/1erb
carriewalsh Mar 13, 2019
4954107
Adds first get to controller
carriewalsh Mar 13, 2019
b5cd4c6
Adds test file, updates controller to use index
carriewalsh Mar 13, 2019
3d75295
Merge pull request #4 from carriewalsh/1controller
carriewalsh Mar 13, 2019
a26ac7f
Migrates table...idk I think I created the database, and made an empt…
carriewalsh Mar 13, 2019
5629175
Seeds bourbon data
carriewalsh Mar 13, 2019
31b4a03
Merge pull request #5 from carriewalsh/1db
carriewalsh Mar 13, 2019
890eff0
Adds model tests for bourbon
carriewalsh Mar 13, 2019
7516ed2
Adds bourbon model initialize and all
carriewalsh Mar 13, 2019
751d64d
Adds feature tests and comments out lots of seed data
carriewalsh Mar 14, 2019
67aaafb
Removes init/attr from model, creates layout, un-comments seeds
carriewalsh Mar 14, 2019
23e7579
Adds models for statistics
carriewalsh Mar 14, 2019
22b6152
Fixing css to try to side scroll
carriewalsh Mar 14, 2019
2ea4338
Fixes header and allows side-scroll of bourbon cards
carriewalsh Mar 14, 2019
47fb017
Merge pull request #6 from carriewalsh/1model
carriewalsh Mar 14, 2019
9d7843b
Adds award seed data, local image files
carriewalsh Mar 14, 2019
328ff57
Adds awards data
carriewalsh Mar 14, 2019
76cd05f
Merge pull request #7 from carriewalsh/2db
carriewalsh Mar 14, 2019
d727ed4
Adds award model and award methods to html
carriewalsh Mar 14, 2019
0ec61e9
Fixed errors with seed data
carriewalsh Mar 14, 2019
64b097e
Adds award.all to controller
carriewalsh Mar 14, 2019
f429787
Merge pull request #8 from carriewalsh/2model
carriewalsh Mar 14, 2019
d676cdf
Adds inherit method to header so bourbons scroll behind
carriewalsh Mar 14, 2019
83d1fec
Merge pull request #9 from carriewalsh/2views
carriewalsh Mar 14, 2019
1fba30b
Adds class method testing for bourbon
carriewalsh Mar 14, 2019
4fe19f3
Fixes issues so rspec runs correctly
carriewalsh Mar 14, 2019
efbc84f
Adds before :each to spec files
carriewalsh Mar 14, 2019
242944d
Adds current index features tests
carriewalsh Mar 14, 2019
cc19a4d
Added numbers to expect statements, fixed avg_rating to round to 2 dec
carriewalsh Mar 14, 2019
bf946bf
Adds test for location and location link
carriewalsh Mar 14, 2019
6d82818
Adds test file for bourbons/new
carriewalsh Mar 14, 2019
10b5937
Merge pull request #10 from carriewalsh/tests
carriewalsh Mar 14, 2019
3159e63
Adds new controller methods for sort and select
carriewalsh Mar 14, 2019
b86aa95
Attempts to add state list to statistics section
carriewalsh Mar 14, 2019
9882597
Creates method to get uniq list of states
carriewalsh Mar 14, 2019
46266a8
Adds links to each state at the bottom of the locations section
carriewalsh Mar 14, 2019
feec3da
Adds methods to bourbon model - all tests pass for model
carriewalsh Mar 14, 2019
157af2b
Adds view/new with form in it - tests pass
carriewalsh Mar 14, 2019
1947c5f
Adds labels and breaks to views/new
carriewalsh Mar 14, 2019
2561a58
Adds route for new bourbon that works
carriewalsh Mar 15, 2019
a1e0f20
Makes state links into form submit buttons
carriewalsh Mar 15, 2019
6894485
Adds controller / views for state select buttons
carriewalsh Mar 15, 2019
e2dd38a
Merge pull request #11 from carriewalsh/2controller
carriewalsh Mar 15, 2019
286e969
Adds color to hover for state-buttons
carriewalsh Mar 15, 2019
e13a266
Changes bourbons margin-top to vw
carriewalsh Mar 15, 2019
d01d68a
Adds SimpleCov gem and cleans up a little in test/index
carriewalsh Mar 15, 2019
5145d3e
Adds SimpleCov to spec_helper
carriewalsh Mar 15, 2019
695d353
Simplifies methods to just sort_by() and adds functionality to contro…
carriewalsh Mar 15, 2019
9c15dad
Makes all sort_by options buttons that are functional
carriewalsh Mar 15, 2019
79ddca8
Merge pull request #12 from carriewalsh/3views
carriewalsh Mar 15, 2019
25f6915
Cleans up commented out code
carriewalsh Mar 15, 2019
050c671
Merge pull request #13 from carriewalsh/1cleanup
carriewalsh Mar 15, 2019
9c89b61
Fixes award card css - now flexes
carriewalsh Mar 15, 2019
632174b
Changes some header sizing
carriewalsh Mar 15, 2019
f2c1aa3
Changes some font sizes and adds rounding to view
carriewalsh Mar 15, 2019
3c78c9d
Adds award validation tests, works on css
carriewalsh Mar 15, 2019
2038b76
Changes bourbon/new css
carriewalsh Mar 15, 2019
e2389aa
Centers header
carriewalsh Mar 15, 2019
4ce2f7f
Merge pull request #14 from carriewalsh/4views
carriewalsh Mar 15, 2019
77ae684
Adds feature tests for bourbon-cards
carriewalsh Mar 17, 2019
c35959c
Adds Feature tests for new and main
carriewalsh Mar 17, 2019
77964c1
Changes description input to text area
carriewalsh Mar 17, 2019
13bfdf9
Adds award-card test
carriewalsh Mar 17, 2019
8ef5983
Adds select state, award image tests
carriewalsh Mar 17, 2019
a2e710b
Cleans up tests
carriewalsh Mar 17, 2019
44df496
Merge pull request #15 from carriewalsh/2tests
carriewalsh Mar 17, 2019
7a70105
Cleans up comments
carriewalsh Mar 17, 2019
420c478
Merge pull request #16 from carriewalsh/cleanup
carriewalsh Mar 17, 2019
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
Gemfile.lock
tmp/
/coverage
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ group :development, :test do
gem 'rspec'
gem 'shotgun'
gem 'tux'
gem "simplecov"
end
32 changes: 16 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,9 @@ User Story 7
As a visitor
When I visit `/comedians?age=34`
Then I see a list of all comedians with an age of 34
Just like a previous User Story, BUT all other statistics
information in the 'Statistics' area of the page should be limited
to reflect only the information about the comedians listed on
Just like a previous User Story, BUT all other statistics
information in the 'Statistics' area of the page should be limited
to reflect only the information about the comedians listed on
the page.

- Testing should ensure that calculated statistics are
Expand Down Expand Up @@ -182,20 +182,20 @@ sorted alphabetically by the age of the comedian.
At the end of this project, write a reflection on what you learned and implemented.
This will help you review your own code and gain practice explaining/talking through the code and the process/decisions that were made along the way. Include code snippets from the project in your explanations.

We reccommend writing your blog on [Medium](https://medium.com), but if you have a blog site that you already use that is okay too. However, it must be publically accessible and the link should be submitted to your instructors via Direct Message.
We recommend writing your blog on [Medium](https://medium.com), but if you have a blog site that you already use that is okay too. However, it must be publicly accessible and the link should be submitted to your instructors via Direct Message.

Here are some questions to think about as you write your post:
Here are some questions to think about as you write your post:

- How did you approach this project?
- How did you approach this project?
What sort of planning did you do?

- What was the most challenging part of the project?
How did you deal with that challenge?
Were you able to overcome it?
How did you deal with that challenge?
Were you able to overcome it?
If yes, how did you overcome it?
If no, what do you think is the reason for not being able to and what would you do differenlty?
- What did you enjoy most about the project?
If no, what do you think is the reason for not being able to and what would you do differently?

- What did you enjoy most about the project?

- What part of the project are you most proud of and why?

Expand All @@ -212,8 +212,8 @@ This project is not evaluated. HOWEVER, the following is an example rubric we mi

| | 1. Below Standard | 2. Approaching Standard | 3. Meets Standard | 4. Above Standard |
|--- |--- |--- |--- |--- |
| Featrure Completeness | - Fewer than 75% of stories are complete | - 75% of user stories are complete, but not all of them are fully implemented | - All user stories are complete | All user stories are completed and additional extension work was attempted|
| MVC Responsibilities | - Models, Views, and Controllers do not have clear responsiblities EX. Views are making calls to the model or database, Controllers are handiling calculations or making database calls | Views contain logic that makes significant calls to the database OR Controllers are handling calcualations OR Models process data ineffciently and is not passing responsiblity to database | - Views only contain `.each` calls, branch logic, and formatted CSS - Controllers push almost all the work to the Models for reading/writing data to the database - Models handle calulcations and interactions with the database | - Views only display data and do not make addiontal calls to the databsae; they may include branch logic - Controllers request all data from Models excepts `.all`, `.find`, `.create`, `.delete` methods - Models read/write all other dta using branch lgoic of smaller methods |
| Feature Completeness | - Fewer than 75% of stories are complete | - 75% of user stories are complete, but not all of them are fully implemented | - All user stories are complete | All user stories are completed and additional extension work was attempted|
| MVC Responsibilities | - Models, Views, and Controllers do not have clear responsibilities EX. Views are making calls to the model or database, Controllers are handling calculations or making database calls | Views contain logic that makes significant calls to the database OR Controllers are handling calculations OR Models process data inefficiently and is not passing responsibility to database | - Views only contain `.each` calls, branch logic, and formatted CSS - Controllers push almost all the work to the Models for reading/writing data to the database - Models handle calculations and interactions with the database | - Views only display data and do not make additional calls to the database; they may include branch logic - Controllers request all data from Models excepts `.all`, `.find`, `.create`, `.delete` methods - Models read/write all other data using branch logic of smaller methods |
| ActiveRecord | - No ActiveRecord used | - Using Ruby enumerables where ActiveRecord could be used mixed with some ActiveRecord | - Using ActiveRecord to handle calculations and interactions to the database correctly | - Using most efficient ActiveRecord queries |
| Testing | - Below 75% coverage | - Testing coverage is between 75-98% - Models tests are incomplete - Hardcoding values for expectations - Poorly written | - 98% of better test coverage for feature tests - 100% for model tests - Using variable as opposed to hard coding values - Use of within blocks for targeted feature test - Robustly written tests | - Clear TDD - Test Filse extremely organized - Utilize `before(:each)` blocks for test setup - 100% coverage for features and models |
| Usability/Styling | - Little or no Styling - User workflow is problematic (must type urls) | - Styling is incomplete - Layout does not follow good HTML patterns - Incomplete Navigation | - Purposeful styling pattern (complementary color choices, intentional layout of HTML - Links/Buttons to reach all ares of the site | -Extremley well styled and purposeful layout(production ready) - Excellent color scheme and font usage(not default fonts) - Easy to use and follow application flow (does not have to search for links or buttons on the page) - Utilizes addiontal tooling(ex. SCSS) |
| Testing | - Below 75% coverage | - Testing coverage is between 75-98% - Models tests are incomplete - Hardcoding values for expectations - Poorly written | - 98% of better test coverage for feature tests - 100% for model tests - Using variable as opposed to hard coding values - Use of within blocks for targeted feature test - Robustly written tests | - Clear TDD - Test Files extremely organized - Utilize `before(:each)` blocks for test setup - 100% coverage for features and models |
| Usability/Styling | - Little or no Styling - User workflow is problematic (must type urls) | - Styling is incomplete - Layout does not follow good HTML patterns - Incomplete Navigation | - Purposeful styling pattern (complementary color choices, intentional layout of HTML - Links/Buttons to reach all ares of the site | -Extremely well styled and purposeful layout(production ready) - Excellent color scheme and font usage(not default fonts) - Easy to use and follow application flow (does not have to search for links or buttons on the page) - Utilizes additional tooling(ex. SCSS) |
32 changes: 32 additions & 0 deletions app/controllers/laugh_tracks_app.rb
Original file line number Diff line number Diff line change
@@ -1,2 +1,34 @@
require_relative "../models/bourbon"
require "pry"

class LaughTracksApp < Sinatra::Base
set :root, File.expand_path("..", __dir__)
set :public_folder, File.dirname(__FILE__) + '../public'

get "/bourbons" do
if params.has_key?("sort")
@bourbons = Bourbon.sort_by(params[:sort].downcase)
elsif params.has_key?("select")
@bourbons = Bourbon.select_state(params[:select])
else
@bourbons = Bourbon.all
end
@awards = Award.all
erb :index
end

get "/bourbons/" do
@bourbons = Bourbon.all
@awards = Award.all
erb :index
end

get "/bourbons/new" do
erb :new
end

post "/bourbons" do
bourbon = Bourbon.create(params[:bourbon])
redirect "/bourbons"
end
end
8 changes: 8 additions & 0 deletions app/models/award.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
class Award < ActiveRecord::Base
belongs_to :bourbons

validates_presence_of :name,
:award_type,
:year,
:image
end
48 changes: 48 additions & 0 deletions app/models/bourbon.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
class Bourbon < ActiveRecord::Base
has_many :awards

validates_presence_of :name,
:distillery,
:location,
:description,
:proof,
:expert_score,
:avg_rating,
:bottle_image

def self.avg_proof
avg = Bourbon.average(:proof)
end

def self.avg_expert_score
avg = Bourbon.average(:expert_score)
end

def self.avg_avg_rating
avg = Bourbon.average(:avg_rating)
end

def self.cities
bourbons = Bourbon.pluck(:location).uniq
end

def self.select_state(state)
bourbons = Bourbon.where("location LIKE '%#{state}'")
end

def self.sort_by(param)
if param == "avg_rating" || param == "expert_score"
bourbons = Bourbon.order(param.to_sym => :desc)
else
bourbons = Bourbon.order(param.to_sym)
end
end

def self.list_states
cities = Bourbon.pluck(:location)
states = cities.map do |city|
city[-2,2]
end
states.uniq.sort
end
end
2 changes: 0 additions & 2 deletions app/models/comedian.rb

This file was deleted.

Loading