Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
def6548
start
dwisecar Dec 3, 2020
c9172f0
end day one
dwisecar Dec 3, 2020
f84bf50
created models
dwisecar Dec 3, 2020
1835c76
created load_to_db
dwisecar Dec 3, 2020
1463237
saving_to_db
dwisecar Dec 3, 2020
3a37b6c
Merge pull request #1 from dwisecar/saving_new_events
dwisecar Dec 3, 2020
5997bc9
created user buy ticket
dwisecar Dec 3, 2020
1b9de57
added status column migration and display_events method
racross1 Dec 3, 2020
84a633e
Merge pull request #2 from dwisecar/display-to-console
racross1 Dec 3, 2020
9b8d8df
Merge branch 'master' into saving_new_events
dwisecar Dec 3, 2020
de21964
Merge pull request #3 from dwisecar/saving_new_events
dwisecar Dec 3, 2020
4bd7f92
added menu class
dwisecar Dec 3, 2020
62542f0
add state to search and user schema
racross1 Dec 4, 2020
593071d
Merge pull request #4 from dwisecar/add-state-to-search
racross1 Dec 4, 2020
394df79
changed create_user to find_or_create_user_by
racross1 Dec 4, 2020
e317df2
Merge pull request #5 from dwisecar/find_or_create_by_user_feature
racross1 Dec 4, 2020
90dd3f3
added option to return to start or exit at any time
racross1 Dec 4, 2020
be3b466
Merge pull request #6 from dwisecar/add_exit_key_functionality
racross1 Dec 4, 2020
ddbd68e
added search by name
dwisecar Dec 4, 2020
253146e
Merge branch 'master' into search_by_name_feature
dwisecar Dec 4, 2020
8c51a79
Merge pull request #7 from dwisecar/search_by_name_feature
dwisecar Dec 4, 2020
302d1ba
Update menu.rb
dwisecar Dec 4, 2020
5f0fbff
error message on no results found in artist search
dwisecar Dec 4, 2020
09dec58
Merge pull request #9 from dwisecar/search_empty_results
dwisecar Dec 4, 2020
35676ac
save fix
dwisecar Dec 4, 2020
5ca8a9a
Merge pull request #10 from dwisecar/search_empty_results
dwisecar Dec 4, 2020
3c24d30
buy ticket method complete
dwisecar Dec 4, 2020
a34244b
display user tickets
dwisecar Dec 4, 2020
320bc70
accounted for case sensitivity in search by name
dwisecar Dec 4, 2020
d077a1b
Merge pull request #11 from dwisecar/buy_ticket_feature
dwisecar Dec 4, 2020
bacb9d6
added city and type to event, added error catch for no results
racross1 Dec 4, 2020
499547e
Merge branch 'master' into add_city_and_subgenre_to_events
racross1 Dec 4, 2020
da5b079
Merge pull request #12 from dwisecar/add_city_and_subgenre_to_events
racross1 Dec 4, 2020
1c2b899
logging in feature complete, also now can search by multiple words
dwisecar Dec 4, 2020
44a5eb6
Merge pull request #13 from dwisecar/find_user_feature
dwisecar Dec 4, 2020
673c623
added exit in opening screen, modified #error to delete user
dwisecar Dec 4, 2020
9988c1d
Merge pull request #14 from dwisecar/find_user_feature
dwisecar Dec 4, 2020
6bdc36d
added search by genre functionality
racross1 Dec 4, 2020
026f34e
added search by genre functionality
racross1 Dec 4, 2020
e13f5ba
Merge branch 'master' into display_by_genre
racross1 Dec 4, 2020
5273394
added see results in my city
dwisecar Dec 4, 2020
1b7769f
Merge pull request #16 from dwisecar/filter_events_by_user_city_feature
dwisecar Dec 4, 2020
f9b6b5a
Merge pull request #15 from dwisecar/display_by_genre
racross1 Dec 5, 2020
da784c8
#display_results now sorted by date
dwisecar Dec 5, 2020
a23b6ef
Merge pull request #17 from dwisecar/search_by_date
dwisecar Dec 5, 2020
9e4db02
Search-by-date completed.
dwisecar Dec 5, 2020
362c0fd
Merge pull request #18 from dwisecar/search_by_date
dwisecar Dec 5, 2020
1ed72af
fixed if no results found by date
dwisecar Dec 5, 2020
91bdddd
Merge pull request #19 from dwisecar/search_by_date
dwisecar Dec 5, 2020
494ba0f
Refactored user methods and search by name
dwisecar Dec 6, 2020
801d9b3
Added change user city
dwisecar Dec 7, 2020
18cbf6e
#load_event_details now has .dig()
dwisecar Dec 7, 2020
e8b2de1
Merge pull request #21 from dwisecar/refactoring_menu
dwisecar Dec 7, 2020
c9ecba1
status tracker change
dwisecar Dec 7, 2020
64bb4bc
more resultsgit add .
dwisecar Dec 7, 2020
05bc628
refactor genre search and add state to events
racross1 Dec 7, 2020
7909a53
Merge pull request #22 from dwisecar/refactor_genre_search_class
racross1 Dec 7, 2020
c99b7cd
3 pages of results from API
dwisecar Dec 7, 2020
8283cd2
Merge pull request #23 from dwisecar/status_tracker_feature
dwisecar Dec 7, 2020
b8faacd
change user city pulling more data
dwisecar Dec 7, 2020
659a77c
Final API path, patching #track_events and #enter_city.
dwisecar Dec 7, 2020
92af0ec
Merge pull request #24 from dwisecar/final_changes
dwisecar Dec 7, 2020
010f9ea
fixed bugs in display by genre
racross1 Dec 8, 2020
2dd9926
Merge branch 'master' into bug_find
racross1 Dec 8, 2020
1c1a057
Merge pull request #25 from dwisecar/bug_find
racross1 Dec 8, 2020
7816562
added demo video
dwisecar Dec 8, 2020
cd7eacc
merge conflict white space
dwisecar Dec 8, 2020
395141a
adding video
dwisecar Dec 8, 2020
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
Binary file added Event Tracker video .mov
Binary file not shown.
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ source "https://rubygems.org"
gem "sinatra-activerecord"
gem "sqlite3"
gem "pry"
gem 'rake'
gem "require_all"

58 changes: 30 additions & 28 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,56 +1,58 @@
GEM
remote: https://rubygems.org/
specs:
activemodel (6.0.3.1)
activesupport (= 6.0.3.1)
activerecord (6.0.3.1)
activemodel (= 6.0.3.1)
activesupport (= 6.0.3.1)
activesupport (6.0.3.1)
activemodel (6.0.3.4)
activesupport (= 6.0.3.4)
activerecord (6.0.3.4)
activemodel (= 6.0.3.4)
activesupport (= 6.0.3.4)
activesupport (6.0.3.4)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 0.7, < 2)
minitest (~> 5.1)
tzinfo (~> 1.1)
zeitwerk (~> 2.2, >= 2.2.2)
coderay (1.1.1)
concurrent-ruby (1.1.6)
i18n (1.8.2)
coderay (1.1.3)
concurrent-ruby (1.1.7)
i18n (1.8.5)
concurrent-ruby (~> 1.0)
method_source (0.8.2)
minitest (5.14.1)
mustermann (1.0.3)
pry (0.10.4)
coderay (~> 1.1.0)
method_source (~> 0.8.1)
slop (~> 3.4)
method_source (1.0.0)
minitest (5.14.2)
mustermann (1.1.1)
ruby2_keywords (~> 0.0.1)
pry (0.13.1)
coderay (~> 1.1)
method_source (~> 1.0)
rack (2.2.3)
rack-protection (2.0.7)
rack-protection (2.1.0)
rack
require_all (1.3.3)
sinatra (2.0.7)
rake (13.0.1)
require_all (3.0.0)
ruby2_keywords (0.0.2)
sinatra (2.1.0)
mustermann (~> 1.0)
rack (~> 2.0)
rack-protection (= 2.0.7)
rack (~> 2.2)
rack-protection (= 2.1.0)
tilt (~> 2.0)
sinatra-activerecord (2.0.12)
activerecord (>= 3.2)
sinatra-activerecord (2.0.21)
activerecord (>= 4.1)
sinatra (>= 1.0)
slop (3.6.0)
sqlite3 (1.3.13)
sqlite3 (1.4.2)
thread_safe (0.3.6)
tilt (2.0.10)
tzinfo (1.2.7)
tzinfo (1.2.8)
thread_safe (~> 0.1)
zeitwerk (2.3.0)
zeitwerk (2.4.2)

PLATFORMS
ruby

DEPENDENCIES
pry
rake
require_all
sinatra-activerecord
sqlite3

BUNDLED WITH
1.14.6
2.1.4
98 changes: 98 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,108 @@ Projects need to be approved prior to launching into them, so take some time to
- Present any code you would like to highlight.
7. *OPTIONAL, BUT RECOMMENDED*: Write a blog post about the project and process.






### Option One - Data Analytics Project
1. Access a Sqlite3 Database using ActiveRecord.

2. You should have at minimum three models including one join model. This means you must have a many-to-many relationship.
User >--- Ticket ---< Event ---< Venue ---< City

User has_many Tickets
User has_many Events through Tickets
Ticket belongs to one user
Ticket belongs to one event
Event has_one venue
Event has_one City through Venue
Event has many tickets
Event has many users through tickets
Venue has many events
Venue belongs to one city

3. You should seed your database using data that you collect either from a CSV, a website by scraping, or an API.
Ticket master API
API Key: QATrioQ3vEzlLyBebumHRHuNBfT39vrZ
API call format: https://app.ticketmaster.com/{package}/{version}/{resource}.json?apikey=**{API key}
-package: discovery?
-version: v2?
-resources: event, attraction, classification, venue...

4. Your models should have methods that answer interesting questions about the data. For example, if you've collected info about movie reviews, what is the most popular movie? What movie has the most reviews?
I want to see all events in my city
I want to see events near me on a certain day
I want to see if a certain artist or event is happening near me
I want to see what events are happening near me sorted by genre
I want to buy a ticket to an event
I want to see if the event I had a ticket for has been cancelled
I want to see the events I have tickets to

5. You should provide a CLI to display the return values of your interesting methods.
Feature branches to build:
-search by date option
-see all genre options in my city, and pick one to see all events in that genre (1. Musicals, 2. NFL, 3. Country)
-method to call when search has no results
-find user when logging in

6. Use good OO design patterns. You should have separate classes for your models and CLI interface.


User CLI options
-User starts by entering location
-takes a string of city and checks if valid in database
-if no, puts out "City not found"
-if yes, store city in args hash, start next method for date

0. search by attraction name.
1. search by date MM/DD/YYYY
0-9 reserved for results
-if 0-9 puts event details with y to buy and n to go back
F. filter option menu which puts out which keys to input for another filter
D. to enter a date into the search and filter results by it
P. to enter a price into the search and filter results by it
G. to enter and filter by genre
2.search by price
0-9 reserved for results
F. filter option menu which puts out which keys to input for another filter
D. to enter a date into the search and filter results by it
P. to enter a price into the search and filter results by it
G. to enter and filter by genre
3. search by genre
0-9 reserved for results
F. filter option menu which puts out which keys to input for another filter
D. to enter a date into the search and filter results by it
P. to enter a price into the search and filter results by it
G. to enter and filter by genre




-Entering B goes back to previous page
-See all Events available by date
-see all Events available by price range
-user sees list of events, can select one with 0-9 input
-sees event, venue, price, then Y/N to purchase ticket
-Y takes them back to main page
-N goes back one level
-purchase ticket for event
-See events they have tickets for
-see events they have tickets for by date
-See events they have that are not cancelled





---
### Common Questions:
- How do I turn off my SQL logger?
```ruby
# in config/environment.rb add this line:
ActiveRecord::Base.logger = nil



```
10 changes: 10 additions & 0 deletions app/date_search.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
class DateSearch

def search_by_date
puts "Please enter a date: MM/DD/YYYY"
date = STDIN.gets.chomp.split("/")
date_formatted = "#{date[2]}-#{date[0]}-#{date[1]}"
Event.all.select {|e|e.date == date_formatted}
end

end
44 changes: 44 additions & 0 deletions app/genre_search.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
class GenreSearch
def numbered_types(events)
i = 1
numbered_types = {}
event_types = events.map{|event| event.event_type}.uniq
event_types.each do |type|
if type == "Undefined"
type = "Other"
numbered_types[i] = type
else
numbered_types[i] = type
end
i += 1
end
numbered_types
end

def genre_results(type, events)
if type == "Other"
type = "Undefined"
end
events_filtered_by_type = events.select {|event|event.event_type == type}
end

def numbered_genres(events_filtered_by_type)
i = 1
numbered_genres = {}
event_genres = events_filtered_by_type.map{|event| event.genre}.uniq
event_genres.each do |genre|
if genre == nil || genre == "Undefined"
genre = "Other"
numbered_genres[i] = genre
else
numbered_genres[i] = genre
end
i += 1
end
numbered_genres
end



end

Loading