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

Panda Tiger Eagle #12

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
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
6 changes: 0 additions & 6 deletions config/database.yml.sample

This file was deleted.

9 changes: 9 additions & 0 deletions db/migrate/201212030900_create_modes.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
class CreateModes < ActiveRecord::Migration
def change
create_table :modes do |t|
t.string :name
t.string :parent
t.string :steps
end
end
end
11 changes: 11 additions & 0 deletions db/seed.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
# Cleaning Out
Network.delete_all
Show.delete_all
Mode.delete_all
amc = Network.create(name: "AMC")
nbc = Network.create(name: "NBC")
abc = Network.create(name: "ABC")
pbs = Network.create(name: "PBS")
Show.create(name: "Mad Men", day_of_week: "Sunday", hour_of_day: 22, network: amc)
Show.create(name: "Community", day_of_week: "Thursday", hour_of_day: 20, network: nbc)
Show.create(name: "Modern Family", day_of_week: "Wednesday", hour_of_day: 21, network: abc)
Show.create(name: "Downton Abbey", day_of_week: "Sunday", hour_of_day: 21, network: pbs)
Mode.create(name: "Ionian", parent: "Major", steps: "1 2 3 4 5 6 7")
Mode.create(name: "Dorian", parent: "Major", steps: "1 2 b3 4 5 6 b7")
Mode.create(name: "Phrygian", parent: "Major", steps: "1 b2 b3 4 5 b6 b7")
Mode.create(name: "Lydian", parent: "Major", steps: "1 2 3 #4 5 6 7")
Mode.create(name: "Lydian Augmented", parent: "Melodic Minor", steps: "1 2 3 #4 #5 6 7")
Mode.create(name: "Super Locrian", parent: "Melodic Minor", steps: "1 b2 b3 b4 b5 b6 b7")
7 changes: 7 additions & 0 deletions models/mode.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
class Mode < ActiveRecord::Base

def to_s
name
end

end
34 changes: 33 additions & 1 deletion watchman.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,43 @@
Dir.glob('./models/*').each { |r| require r}
require "./db/seed"

puts "There are #{Show.count} in the database"
puts "There are #{Show.count} in the database:"

Network.all.each do |network|
puts "Shows airing on #{network}"
network.shows.each do |show|
puts show
end
end

puts "\nWhat day do you want to watch shows?"
user_day = gets.chomp()

shows_by_day = Show.where(day_of_week: user_day.capitalize)

if shows_by_day.size == 0
puts "\nSorry, no shows that day!"
else
puts "\nThere is #{shows_by_day.count} show on #{user_day.capitalize}:" if shows_by_day.size == 1
puts "\nThere are #{shows_by_day.count} shows on #{user_day.capitalize}:" if shows_by_day.size > 1
shows_by_day.each do |show_day|
puts show_day
end
end

puts "\nThe are #{Mode.count} scales in the database:"

Mode.all.each do |mode|
puts mode
end

puts "\nWhich mode would you like to learn more about?"
user_mode = gets.chomp()

current_mode = Mode.where(name: user_mode.titleize).first

if current_mode == nil
puts "\nSorry, no mode by that name!"
else
puts "\nThe scale steps of #{current_mode.name} are #{current_mode.steps}. It is a mode of the #{current_mode.parent} scale.\n"
end