Pick-a-Plex App: The Pinnacle of Cinema Experiences
-
Upload
flatiron-school -
Category
Software
-
view
66 -
download
1
description
Transcript of Pick-a-Plex App: The Pinnacle of Cinema Experiences
![Page 1: Pick-a-Plex App: The Pinnacle of Cinema Experiences](https://reader033.fdocuments.us/reader033/viewer/2022051818/54b6e4d64a7959aa3d8b468c/html5/thumbnails/1.jpg)
Pick-a-PlexThe Pinnacle Cinema
ExperienceChris Callahan & Randall Reed, Jr.
Flatiron School PresentsAugust 19th, 2014
![Page 2: Pick-a-Plex App: The Pinnacle of Cinema Experiences](https://reader033.fdocuments.us/reader033/viewer/2022051818/54b6e4d64a7959aa3d8b468c/html5/thumbnails/2.jpg)
The Problem● Too many
theaters!● Too many
showtimes!● Too much time to
choose!
![Page 3: Pick-a-Plex App: The Pinnacle of Cinema Experiences](https://reader033.fdocuments.us/reader033/viewer/2022051818/54b6e4d64a7959aa3d8b468c/html5/thumbnails/3.jpg)
APIs“JSON is the lingua franca of the Internet”
![Page 4: Pick-a-Plex App: The Pinnacle of Cinema Experiences](https://reader033.fdocuments.us/reader033/viewer/2022051818/54b6e4d64a7959aa3d8b468c/html5/thumbnails/4.jpg)
![Page 5: Pick-a-Plex App: The Pinnacle of Cinema Experiences](https://reader033.fdocuments.us/reader033/viewer/2022051818/54b6e4d64a7959aa3d8b468c/html5/thumbnails/5.jpg)
Integrating the YouTube API$( '.movie-title' ).on( 'click', function() {
var title = $( this ).text().split( ' ' ).join( '+' );
var that = $( this );
if ( !$( this ).has( 'a' ).length ) {
$.get( 'https://www.googleapis.com/youtube/v3/search?part=snippet' +
'&order=rating&q=' + title + '+Official+Trailer&type=video' +
'&videoDefinition=high&videoEmbeddable=true' +
'&key=<%= ENV["YOUTUBE_API_KEY"] %>', function( data ) {
var slug = data.items[0].id.videoId;
that.append( '<br><a class="iframe" target="_blank"' +
'href="//www.youtube.com/embed/' + slug +
'">Want to see the trailer?</a>' );
});
}});
![Page 6: Pick-a-Plex App: The Pinnacle of Cinema Experiences](https://reader033.fdocuments.us/reader033/viewer/2022051818/54b6e4d64a7959aa3d8b468c/html5/thumbnails/6.jpg)
Performance Enhancements
● Raw SQL query to retrieve all data
![Page 7: Pick-a-Plex App: The Pinnacle of Cinema Experiences](https://reader033.fdocuments.us/reader033/viewer/2022051818/54b6e4d64a7959aa3d8b468c/html5/thumbnails/7.jpg)
sql = <<-SQL SELECT theaters.name, theaters.id, theaters.rating, movies.title, movies.tomatometer,
movies.description, showtimes.time, showtimes.fandango_url, showtimes.three_d FROM theaters JOIN ( SELECT showtimes.theater_id, movies.tomatometer FROM showtimes JOIN movies ON movies.id = showtimes.movie_id WHERE showtimes.theater_id = "#{self.id}" AND showtimes.time > "#{current_time}" GROUP BY showtimes.theater_id, movies.tomatometer ORDER BY movies.tomatometer DESC LIMIT 1 OFFSET 2 ) third_tomatometer ON theaters.id = third_tomatometer.theater_id JOIN showtimes ON showtimes.theater_id = theaters.id JOIN movies ON movies.tomatometer >= third_tomatometer.tomatometer AND movies.id = showtimes.movie_id WHERE showtimes.time > "#{current_time}" ORDER BY movies.tomatometer DESC, movies.title, showtimes.timeSQL ActiveRecord::Base.connection.execute(sql)
![Page 8: Pick-a-Plex App: The Pinnacle of Cinema Experiences](https://reader033.fdocuments.us/reader033/viewer/2022051818/54b6e4d64a7959aa3d8b468c/html5/thumbnails/8.jpg)
Performance Enhancements
● Raw SQL query to retrieve all data
● Rake tasks to delete old showtimes and call Rotten Tomatoes API
![Page 9: Pick-a-Plex App: The Pinnacle of Cinema Experiences](https://reader033.fdocuments.us/reader033/viewer/2022051818/54b6e4d64a7959aa3d8b468c/html5/thumbnails/9.jpg)
![Page 10: Pick-a-Plex App: The Pinnacle of Cinema Experiences](https://reader033.fdocuments.us/reader033/viewer/2022051818/54b6e4d64a7959aa3d8b468c/html5/thumbnails/10.jpg)
Performance Enhancements
● Raw SQL query to retrieve all data
● Rake tasks to delete old showtimes and call Rotten Tomatoes API
● Check zip code before loading showtimes
![Page 11: Pick-a-Plex App: The Pinnacle of Cinema Experiences](https://reader033.fdocuments.us/reader033/viewer/2022051818/54b6e4d64a7959aa3d8b468c/html5/thumbnails/11.jpg)
Zip Code Searchclass RequestsController < ApplicationController
def create
# ...
matching_requests = Request.where("zip_code = ? AND created_at > ?",
@request.zip_code, today)
if matching_requests.empty?
@request.save
@request.make_theaters
else
@request = matching_requests.first
end
# ...
end
end
![Page 12: Pick-a-Plex App: The Pinnacle of Cinema Experiences](https://reader033.fdocuments.us/reader033/viewer/2022051818/54b6e4d64a7959aa3d8b468c/html5/thumbnails/12.jpg)
DEMO
![Page 13: Pick-a-Plex App: The Pinnacle of Cinema Experiences](https://reader033.fdocuments.us/reader033/viewer/2022051818/54b6e4d64a7959aa3d8b468c/html5/thumbnails/13.jpg)
Going Forward
● More robust theater rating data
● API caching
● Additional movie info
![Page 14: Pick-a-Plex App: The Pinnacle of Cinema Experiences](https://reader033.fdocuments.us/reader033/viewer/2022051818/54b6e4d64a7959aa3d8b468c/html5/thumbnails/14.jpg)
Thank You@randallocalypse @_c_cal