diff --git a/db/geodata/supplement.sql b/db/geodata/supplement.sql index d14107d23..5e06299be 100644 --- a/db/geodata/supplement.sql +++ b/db/geodata/supplement.sql @@ -16,6 +16,7 @@ CREATE INDEX geoiplocations_geog_gix ON geoiplocations USING GIST (geog); ALTER TABLE geoipblocks DROP COLUMN geom; ALTER TABLE geoipblocks ADD COLUMN geom geometry(polygon); +-- DROP INDEX geoipblocks_geom_gix; UPDATE geoipblocks SET geom = ST_MakeEnvelope(beginip, -1, endip, 1); CREATE INDEX geoipblocks_geom_gix ON geoipblocks USING GIST (geom); @@ -24,13 +25,12 @@ ALTER TABLE jamisp ADD COLUMN geom geometry(polygon); UPDATE jamisp SET geom = ST_MakeEnvelope(beginip, -1, endip, 1); CREATE INDEX jamisp_geom_gix ON jamisp USING GIST (geom); -delete from cities; -insert into cities (city, region, countrycode) select distinct city, region, countrycode from geoiplocations where length(city) > 0 and length(countrycode) > 0; +DELETE FROM cities; +INSERT INTO cities (city, region, countrycode) SELECT DISTINCT city, region, countrycode FROM geoiplocations WHERE length(city) > 0 AND length(countrycode) > 0; +DELETE FROM regions; +INSERT INTO regions (region, countrycode) SELECT DISTINCT region, countrycode FROM cities; +DELETE FROM countries; +INSERT INTO countries (countrycode) SELECT DISTINCT countrycode FROM regions; -delete from regions; -insert into regions (region, countrycode) select distinct region, countrycode from cities; - -delete from countries; -insert into countries (countrycode) select distinct countrycode from regions; VACUUM ANALYSE; diff --git a/db/manifest b/db/manifest index 460706511..97db4f4f6 100755 --- a/db/manifest +++ b/db/manifest @@ -131,4 +131,6 @@ connection_client_type.sql add_countries_regions_and_cities.sql plays_refactor.sql fix_max_mind_isp_and_geo.sql -events.sql \ No newline at end of file +update_get_work_for_client_type.sql +events.sql + diff --git a/db/up/update_get_work_for_client_type.sql b/db/up/update_get_work_for_client_type.sql new file mode 100644 index 000000000..cd356eef7 --- /dev/null +++ b/db/up/update_get_work_for_client_type.sql @@ -0,0 +1,16 @@ +DROP FUNCTION get_work (mylocidispid BIGINT); +CREATE FUNCTION get_work (mylocidispid BIGINT) RETURNS TABLE (client_id VARCHAR(64)) ROWS 5 VOLATILE AS $$ +BEGIN + CREATE TEMPORARY TABLE foo (locidispid BIGINT, locid INT); + INSERT INTO foo SELECT DISTINCT locidispid, locidispid/1000000 FROM connections where client_type = 'client'; + DELETE FROM foo WHERE locidispid IN (SELECT DISTINCT blocidispid FROM current_scores WHERE alocidispid = mylocidispid AND (current_timestamp - score_dt) < interval '24 hours'); + DELETE FROM foo WHERE locid NOT IN (SELECT locid FROM geoiplocations WHERE geog && st_buffer((SELECT geog from geoiplocations WHERE locid = mylocidispid/1000000), 806000)); + CREATE TEMPORARY TABLE bar (client_id VARCHAR(64), locidispid BIGINT, r DOUBLE PRECISION); + INSERT INTO bar SELECT l.client_id, l.locidispid, random() FROM connections l, foo f WHERE l.locidispid = f.locidispid and l.client_type = 'client'; + DROP TABLE foo; + DELETE FROM bar b WHERE r != (SELECT max(r) FROM bar b0 WHERE b0.locidispid = b.locidispid); + RETURN QUERY SELECT b.client_id FROM bar b ORDER BY r LIMIT 5; + DROP TABLE bar; + RETURN; +END; +$$ LANGUAGE plpgsql; diff --git a/ruby/lib/jam_ruby/models/event_session.rb b/ruby/lib/jam_ruby/models/event_session.rb index 21a093c17..ac303b6be 100644 --- a/ruby/lib/jam_ruby/models/event_session.rb +++ b/ruby/lib/jam_ruby/models/event_session.rb @@ -8,7 +8,7 @@ class JamRuby::EventSession < ActiveRecord::Base validates :event, presence: true - validates :pinned_state, :inclusion => {:in => [nil, :not_started, :over]} + validates :pinned_state, :inclusion => {:in => [nil, 'not_started', 'over']} validate :one_of_user_band before_validation :sanitize_active_admin diff --git a/ruby/lib/jam_ruby/models/geo_ip_blocks.rb b/ruby/lib/jam_ruby/models/geo_ip_blocks.rb index a0ffdacd9..b303eaa3e 100644 --- a/ruby/lib/jam_ruby/models/geo_ip_blocks.rb +++ b/ruby/lib/jam_ruby/models/geo_ip_blocks.rb @@ -15,7 +15,97 @@ module JamRuby end def self.import_from_max_mind(file) - # todo implement import_from_max_mind + + # File Geo-134 + # Format: + # startIpNum,endIpNum,locId + + GeoIpBlocks.transaction do + GeoIpBlocks.delete_all + File.open(file, 'r:ISO-8859-1') do |io| + s = io.gets.strip # eat the copyright line. gah, why do they have that in their file?? + unless s.eql? 'Copyright (c) 2011 MaxMind Inc. All Rights Reserved.' + puts s + puts 'Copyright (c) 2011 MaxMind Inc. All Rights Reserved.' + raise 'file does not start with expected copyright (line 1): Copyright (c) 2011 MaxMind Inc. All Rights Reserved.' + end + + s = io.gets.strip # eat the headers line + unless s.eql? 'startIpNum,endIpNum,locId' + puts s + puts 'startIpNum,endIpNum,locId' + raise 'file does not start with expected header (line 2): startIpNum,endIpNum,locId' + end + + saved_level = ActiveRecord::Base.logger ? ActiveRecord::Base.logger.level : 0 + count = 0 + + stmt = "insert into #{GeoIpBlocks.table_name} (beginip, endip, locid) values" + + vals = '' + sep = '' + i = 0 + n = 20 + + csv = ::CSV.new(io, {encoding: 'ISO-8859-1', headers: false}) + csv.each do |row| + raise "file does not have expected number of columns (3): #{row.length}" unless row.length == 3 + + beginip = MaxMindIsp.ip_address_to_int(MaxMindIsp.strip_quotes(row[0])) + endip = MaxMindIsp.ip_address_to_int(MaxMindIsp.strip_quotes(row[1])) + locid = row[2] + + vals = vals+sep+"(#{beginip}, #{endip}, #{locid})" + sep = ',' + i += 1 + + if count == 0 or i >= n then + GeoIpBlocks.connection.execute stmt+vals + count += i + vals = '' + sep = '' + i = 0 + + if ActiveRecord::Base.logger and ActiveRecord::Base.logger.level > 1 then + ActiveRecord::Base.logger.debug "... logging inserts into #{GeoIpBlocks.table_name} suspended ..." + ActiveRecord::Base.logger.level = 1 + end + + if ActiveRecord::Base.logger and count%10000 < n then + ActiveRecord::Base.logger.level = saved_level + ActiveRecord::Base.logger.debug "... inserted #{count} into #{GeoIpBlocks.table_name} ..." + ActiveRecord::Base.logger.level = 1 + end + end + end + + if i > 0 then + GeoIpBlocks.connection.execute stmt+vals + count += i + end + + if ActiveRecord::Base.logger then + ActiveRecord::Base.logger.level = saved_level + ActiveRecord::Base.logger.debug "loaded #{count} records into #{GeoIpBlocks.table_name}" + end + + sts = GeoIpBlocks.connection.execute 'ALTER TABLE geoipblocks DROP COLUMN geom;' + ActiveRecord::Base.logger.debug "DROP COLUMN geom returned sts #{sts.cmd_status}" if ActiveRecord::Base.logger + # sts.check [we don't care] + + sts = GeoIpBlocks.connection.execute 'ALTER TABLE geoipblocks ADD COLUMN geom geometry(polygon);' + ActiveRecord::Base.logger.debug "ADD COLUMN geom returned sts #{sts.cmd_status}" if ActiveRecord::Base.logger + sts.check + + sts = GeoIpBlocks.connection.execute 'UPDATE geoipblocks SET geom = ST_MakeEnvelope(beginip, -1, endip, 1);' + ActiveRecord::Base.logger.debug "SET geom returned sts #{sts.cmd_tuples}" if ActiveRecord::Base.logger + sts.check + + sts = GeoIpBlocks.connection.execute 'CREATE INDEX geoipblocks_geom_gix ON geoipblocks USING GIST (geom);' + ActiveRecord::Base.logger.debug "CREATE INDEX geoipblocks_geom_gix returned sts #{sts.cmd_status}" if ActiveRecord::Base.logger + sts.check + end + end end end end diff --git a/ruby/lib/jam_ruby/models/geo_ip_locations.rb b/ruby/lib/jam_ruby/models/geo_ip_locations.rb index 118c4a9ff..0201ff679 100644 --- a/ruby/lib/jam_ruby/models/geo_ip_locations.rb +++ b/ruby/lib/jam_ruby/models/geo_ip_locations.rb @@ -2,21 +2,149 @@ module JamRuby class GeoIpLocations < ActiveRecord::Base self.table_name = 'geoiplocations' + CITIES_TABLE = 'cities' + REGIONS_TABLE = 'regions' + COUNTRIES_TABLE = 'countries' def self.lookup(locid) - GeoIpLocations.where(locid: locid) + self.where(locid: locid) .limit(1) .first end def self.createx(locid, countrycode, region, city, postalcode, latitude, longitude, metrocode, areacode) c = connection.raw_connection - c.exec_params('insert into geoiplocations (locid, countrycode, region, city, postalcode, latitude, longitude, metrocode, areacode, geog) values($1, $2, $3, $4, $5, $6, $7, $8, $9, ST_SetSRID(ST_MakePoint($7, $6), 4326)::geography)', + c.exec_params("insert into #{self.table_name} (locid, countrycode, region, city, postalcode, latitude, longitude, metrocode, areacode, geog) values($1, $2, $3, $4, $5, $6, $7, $8, $9, ST_SetSRID(ST_MakePoint($7, $6), 4326)::geography)", [locid, countrycode, region, city, postalcode, latitude, longitude, metrocode, areacode]) end + def self.i(s) + return 'NULL' if s.nil? or s.blank? + return s.to_i + end + def self.import_from_max_mind(file) - # todo implement import_from_max_mind + + # File Geo-134 + # Format: + # locId,country,region,city,postalCode,latitude,longitude,metroCode,areaCode + + self.transaction do + self.delete_all + File.open(file, 'r:ISO-8859-1') do |io| + s = io.gets.strip # eat the copyright line. gah, why do they have that in their file?? + unless s.eql? 'Copyright (c) 2012 MaxMind LLC. All Rights Reserved.' + puts s + puts 'Copyright (c) 2012 MaxMind LLC. All Rights Reserved.' + raise 'file does not start with expected copyright (line 1): Copyright (c) 2012 MaxMind LLC. All Rights Reserved.' + end + + s = io.gets.strip # eat the headers line + unless s.eql? 'locId,country,region,city,postalCode,latitude,longitude,metroCode,areaCode' + puts s + puts 'locId,country,region,city,postalCode,latitude,longitude,metroCode,areaCode' + raise 'file does not start with expected header (line 2): locId,country,region,city,postalCode,latitude,longitude,metroCode,areaCode' + end + + saved_level = ActiveRecord::Base.logger ? ActiveRecord::Base.logger.level : 0 + count = 0 + + stmt = "INSERT INTO #{self.table_name} (locid, countrycode, region, city, postalcode, latitude, longitude, metrocode, areacode) VALUES" + + vals = '' + sep = '' + i = 0 + n = 20 + + csv = ::CSV.new(io, {encoding: 'ISO-8859-1', headers: false}) + csv.each do |row| + raise "file does not have expected number of columns (9): #{row.length}" unless row.length == 9 + + locid = row[0] + countrycode = row[1] + region = row[2] + city = row[3] + postalcode = row[4] + latitude = row[5] + longitude = row[6] + metrocode = row[7] + areacode = row[8] + + vals = vals+sep+"(#{locid}, '#{countrycode}', '#{region}', #{MaxMindIsp.quote_value(city)}, '#{postalcode}', #{latitude}, #{longitude}, #{i(metrocode)}, '#{areacode}')" + sep = ',' + i += 1 + + if count == 0 or i >= n then + self.connection.execute stmt+vals + count += i + vals = '' + sep = '' + i = 0 + + if ActiveRecord::Base.logger and ActiveRecord::Base.logger.level > 1 then + ActiveRecord::Base.logger.debug "... logging inserts into #{self.table_name} suspended ..." + ActiveRecord::Base.logger.level = 1 + end + + if ActiveRecord::Base.logger and count%10000 < n then + ActiveRecord::Base.logger.level = saved_level + ActiveRecord::Base.logger.debug "... inserted #{count} into #{self.table_name} ..." + ActiveRecord::Base.logger.level = 1 + end + end + end + + if i > 0 then + self.connection.execute stmt+vals + count += i + end + + if ActiveRecord::Base.logger then + ActiveRecord::Base.logger.level = saved_level + ActiveRecord::Base.logger.debug "loaded #{count} records into #{self.table_name}" + end + + sts = self.connection.execute "ALTER TABLE #{self.table_name} DROP COLUMN geog;" + ActiveRecord::Base.logger.debug "DROP COLUMN geog returned sts #{sts.cmd_status}" if ActiveRecord::Base.logger + # sts.check [we don't care] + + sts = self.connection.execute "ALTER TABLE #{self.table_name} ADD COLUMN geog geography(point, 4326);" + ActiveRecord::Base.logger.debug "ADD COLUMN geog returned sts #{sts.cmd_status}" if ActiveRecord::Base.logger + sts.check + + sts = self.connection.execute "UPDATE #{self.table_name} SET geog = ST_SetSRID(ST_MakePoint(longitude, latitude), 4326)::geography;" + ActiveRecord::Base.logger.debug "SET geog returned sts #{sts.cmd_tuples}" if ActiveRecord::Base.logger + sts.check + + sts = self.connection.execute "CREATE INDEX #{self.table_name}_geog_gix ON #{self.table_name} USING GIST (geog);" + ActiveRecord::Base.logger.debug "CREATE INDEX #{self.table_name}_geog_gix returned sts #{sts.cmd_status}" if ActiveRecord::Base.logger + sts.check + + sts = self.connection.execute "DELETE FROM #{CITIES_TABLE};" + ActiveRecord::Base.logger.debug "DELETE FROM #{CITIES_TABLE} returned sts #{sts.cmd_status}" if ActiveRecord::Base.logger + sts.check + + sts = self.connection.execute "INSERT INTO #{CITIES_TABLE} (city, region, countrycode) SELECT DISTINCT city, region, countrycode FROM #{self.table_name} WHERE length(city) > 0 AND length(countrycode) > 0;" + ActiveRecord::Base.logger.debug "INSERT INTO #{CITIES_TABLE} returned sts #{sts.cmd_status}" if ActiveRecord::Base.logger + sts.check + + sts = self.connection.execute "DELETE FROM #{REGIONS_TABLE};" + ActiveRecord::Base.logger.debug "DELETE FROM #{REGIONS_TABLE} returned sts #{sts.cmd_status}" if ActiveRecord::Base.logger + sts.check + + sts = self.connection.execute "INSERT INTO #{REGIONS_TABLE} (region, countrycode) SELECT DISTINCT region, countrycode FROM #{CITIES_TABLE};" + ActiveRecord::Base.logger.debug "INSERT INTO #{REGIONS_TABLE} returned sts #{sts.cmd_status}" if ActiveRecord::Base.logger + sts.check + + sts = self.connection.execute "DELETE FROM #{COUNTRIES_TABLE};" + ActiveRecord::Base.logger.debug "DELETE FROM #{COUNTRIES_TABLE} returned sts #{sts.cmd_status}" if ActiveRecord::Base.logger + sts.check + + sts = self.connection.execute "INSERT INTO #{COUNTRIES_TABLE} (countrycode) SELECT DISTINCT countrycode FROM #{REGIONS_TABLE};" + ActiveRecord::Base.logger.debug "INSERT INTO #{COUNTRIES_TABLE} returned sts #{sts.cmd_status}" if ActiveRecord::Base.logger + sts.check + end + end end end end diff --git a/ruby/lib/jam_ruby/models/jam_isp.rb b/ruby/lib/jam_ruby/models/jam_isp.rb index 5d640012b..86b56d9ba 100644 --- a/ruby/lib/jam_ruby/models/jam_isp.rb +++ b/ruby/lib/jam_ruby/models/jam_isp.rb @@ -4,6 +4,8 @@ module JamRuby class JamIsp < ActiveRecord::Base self.table_name = 'jamisp' + COMPANY_TABLE = 'jamcompany' + GEOIPISP_TABLE = 'geoipisp' def self.ip_to_num(ip_addr) begin @@ -24,7 +26,7 @@ module JamRuby def self.createx(beginip, endip, coid) c = connection.raw_connection - c.exec_params('insert into jamisp (beginip, endip, coid, geom) values($1::bigint, $2::bigint, $3, ST_MakeEnvelope($1::bigint, -1, $2::bigint, 1))', + c.exec_params("insert into #{self.table_name} (beginip, endip, coid, geom) values($1::bigint, $2::bigint, $3, ST_MakeEnvelope($1::bigint, -1, $2::bigint, 1))", [beginip, endip, coid]) end @@ -37,7 +39,117 @@ module JamRuby end def self.import_from_max_mind(file) - # todo implement import_from_max_mind + + # File Geo-124 + # Format: + # startIpNum,endIpNum,isp + + GeoIpLocations.transaction do + GeoIpLocations.delete_all + File.open(file, 'r:ISO-8859-1') do |io| + #s = io.gets.strip # eat the copyright line. gah, why do they have that in their file?? + #unless s.eql? 'Copyright (c) 2012 MaxMind LLC. All Rights Reserved.' + # puts s + # puts 'Copyright (c) 2012 MaxMind LLC. All Rights Reserved.' + # raise 'file does not start with expected copyright (line 1): Copyright (c) 2012 MaxMind LLC. All Rights Reserved.' + #end + + #s = io.gets.strip # eat the headers line + #unless s.eql? 'locId,country,region,city,postalCode,latitude,longitude,metroCode,areaCode' + # puts s + # puts 'locId,country,region,city,postalCode,latitude,longitude,metroCode,areaCode' + # raise 'file does not start with expected header (line 2): locId,country,region,city,postalCode,latitude,longitude,metroCode,areaCode' + #end + + saved_level = ActiveRecord::Base.logger ? ActiveRecord::Base.logger.level : 0 + count = 0 + + stmt = "insert into #{GEOIPISP_TABLE} (beginip, endip, company) values" + + vals = '' + sep = '' + i = 0 + n = 20 + + csv = ::CSV.new(io, {encoding: 'ISO-8859-1', headers: false}) + csv.each do |row| + raise "file does not have expected number of columns (3): #{row.length}" unless row.length == 3 + + beginip = MaxMindIsp.ip_address_to_int(MaxMindIsp.strip_quotes(row[0])) + endip = MaxMindIsp.ip_address_to_int(MaxMindIsp.strip_quotes(row[1])) + company = row[2] + + vals = vals+sep+"(#{beginip}, #{endip}, #{MaxMindIsp.quote_value(company)})" + sep = ',' + i += 1 + + if count == 0 or i >= n then + GeoIpLocations.connection.execute stmt+vals + count += i + vals = '' + sep = '' + i = 0 + + if ActiveRecord::Base.logger and ActiveRecord::Base.logger.level > 1 then + ActiveRecord::Base.logger.debug "... logging inserts into #{GEOIPISP_TABLE} suspended ..." + ActiveRecord::Base.logger.level = 1 + end + + if ActiveRecord::Base.logger and count%10000 < n then + ActiveRecord::Base.logger.level = saved_level + ActiveRecord::Base.logger.debug "... inserted #{count} into #{GEOIPISP_TABLE} ..." + ActiveRecord::Base.logger.level = 1 + end + end + end + + if i > 0 then + GeoIpLocations.connection.execute stmt+vals + count += i + end + + if ActiveRecord::Base.logger then + ActiveRecord::Base.logger.level = saved_level + ActiveRecord::Base.logger.debug "loaded #{count} records into #{GEOIPISP_TABLE}" + end + + sts = GeoIpLocations.connection.execute "DELETE FROM #{COMPANY_TABLE};" + ActiveRecord::Base.logger.debug "DELETE FROM #{COMPANY_TABLE} returned sts #{sts.cmd_status}" if ActiveRecord::Base.logger + sts.check + + sts = GeoIpLocations.connection.execute "ALTER SEQUENCE #{COMPANY_TABLE}_coid_seq RESTART WITH 1;" + ActiveRecord::Base.logger.debug "ALTER SEQUENCE #{COMPANY_TABLE}_coid_seq returned sts #{sts.cmd_status}" if ActiveRecord::Base.logger + sts.check + + sts = GeoIpLocations.connection.execute "INSERT INTO #{COMPANY_TABLE} (company) SELECT DISTINCT company FROM #{GEOIPISP_TABLE} ORDER BY company;" + ActiveRecord::Base.logger.debug "INSERT INTO #{COMPANY_TABLE} returned sts #{sts.cmd_status}" if ActiveRecord::Base.logger + sts.check + + sts = GeoIpLocations.connection.execute "DELETE FROM #{self.table_name};" + ActiveRecord::Base.logger.debug "DELETE FROM #{self.table_name} returned sts #{sts.cmd_status}" if ActiveRecord::Base.logger + sts.check + + sts = GeoIpLocations.connection.execute "INSERT INTO #{self.table_name} (beginip, endip, coid) SELECT x.beginip, x.endip, y.coid FROM #{GEOIPISP_TABLE} x, #{COMPANY_TABLE} y WHERE x.company = y.company;" + ActiveRecord::Base.logger.debug "INSERT INTO #{self.table_name} returned sts #{sts.cmd_status}" if ActiveRecord::Base.logger + sts.check + + sts = GeoIpLocations.connection.execute "ALTER TABLE #{self.table_name} DROP COLUMN geom;" + ActiveRecord::Base.logger.debug "DROP COLUMN geom returned sts #{sts.cmd_status}" if ActiveRecord::Base.logger + #sts.check [we don't care] + + sts = GeoIpLocations.connection.execute "ALTER TABLE #{self.table_name} ADD COLUMN geom geometry(polygon);" + ActiveRecord::Base.logger.debug "ADD COLUMN geom returned sts #{sts.cmd_status}" if ActiveRecord::Base.logger + sts.check + + sts = GeoIpLocations.connection.execute "UPDATE #{self.table_name} SET geom = ST_MakeEnvelope(beginip, -1, endip, 1);" + ActiveRecord::Base.logger.debug "SET geom returned sts #{sts.cmd_tuples}" if ActiveRecord::Base.logger + sts.check + + sts = GeoIpLocations.connection.execute "CREATE INDEX #{self.table_name}_geom_gix ON #{self.table_name} USING GIST (geom);" + ActiveRecord::Base.logger.debug "CREATE INDEX #{self.table_name}_geom_gix returned sts #{sts.cmd_status}" if ActiveRecord::Base.logger + sts.check + end + end end end end diff --git a/ruby/lib/jam_ruby/models/notification.rb b/ruby/lib/jam_ruby/models/notification.rb index b9f21f4f3..1bf2fa03a 100644 --- a/ruby/lib/jam_ruby/models/notification.rb +++ b/ruby/lib/jam_ruby/models/notification.rb @@ -539,8 +539,13 @@ module JamRuby notifications, online_followers, offline_followers = [], [], [] notification_msg = format_msg(NotificationTypes::BAND_SESSION_JOIN, nil, band) - band.followers.each do |bf| - follower = bf.user + followers = band.followers.map { |bf| bf.user } + + # do not send band session notifications to band members + followers = followers - band.users + + followers.each do |f| + follower = f notification = Notification.new notification.band_id = band.id notification.description = NotificationTypes::BAND_SESSION_JOIN diff --git a/ruby/lib/jam_ruby/models/track.rb b/ruby/lib/jam_ruby/models/track.rb index 554807ea3..6ad15159a 100644 --- a/ruby/lib/jam_ruby/models/track.rb +++ b/ruby/lib/jam_ruby/models/track.rb @@ -75,8 +75,13 @@ module JamRuby to_delete = Set.new(connection_tracks) to_add = Array.new(tracks) + tracks.each do |track| + instruments << track[:instrument_id] + end + connection_tracks.each do |connection_track| tracks.each do |track| + if track[:id] == connection_track.id || track[:client_track_id] == connection_track.client_track_id to_delete.delete(connection_track) to_add.delete(track) @@ -85,8 +90,6 @@ module JamRuby connection_track.sound = track[:sound] connection_track.client_track_id = track[:client_track_id] - instruments << track[:instrument_id] - result.push(connection_track) if connection_track.save diff --git a/web/app/assets/images/event/landing_band_amycook.png b/web/app/assets/images/event/landing_band_amycook.png new file mode 100644 index 000000000..cc4a57e2c Binary files /dev/null and b/web/app/assets/images/event/landing_band_amycook.png differ diff --git a/web/app/assets/images/event/landing_band_ginachavez.png b/web/app/assets/images/event/landing_band_ginachavez.png new file mode 100644 index 000000000..943c51094 Binary files /dev/null and b/web/app/assets/images/event/landing_band_ginachavez.png differ diff --git a/web/app/assets/images/event/landing_band_jgreene.png b/web/app/assets/images/event/landing_band_jgreene.png new file mode 100644 index 000000000..ff76418c0 Binary files /dev/null and b/web/app/assets/images/event/landing_band_jgreene.png differ diff --git a/web/app/assets/images/event/landing_band_jonnytwobags.png b/web/app/assets/images/event/landing_band_jonnytwobags.png new file mode 100644 index 000000000..9112866f2 Binary files /dev/null and b/web/app/assets/images/event/landing_band_jonnytwobags.png differ diff --git a/web/app/assets/images/event/landing_band_mingofishtrap.png b/web/app/assets/images/event/landing_band_mingofishtrap.png new file mode 100644 index 000000000..fc4e117c6 Binary files /dev/null and b/web/app/assets/images/event/landing_band_mingofishtrap.png differ diff --git a/web/app/assets/images/event/landing_band_residualkid.png b/web/app/assets/images/event/landing_band_residualkid.png new file mode 100644 index 000000000..c295fa07c Binary files /dev/null and b/web/app/assets/images/event/landing_band_residualkid.png differ diff --git a/web/app/assets/stylesheets/corp/corporate.css.scss.erb b/web/app/assets/stylesheets/corp/corporate.css.scss.erb index 2e8ca71d6..c4f69802d 100644 --- a/web/app/assets/stylesheets/corp/corporate.css.scss.erb +++ b/web/app/assets/stylesheets/corp/corporate.css.scss.erb @@ -16,10 +16,21 @@ float:left; } -div.test-user-desc { +span.testimonial-user-desc { font-style: italic !important; } +span.press-date { + font-style: italic !important; + color:#999; + line-height:160%; +} + +ul.no-style { + padding-left: 0px !important; + list-style-type: none !important; +} + #nav { margin-top:40px; margin-bottom:30px; @@ -57,8 +68,6 @@ div.test-user-desc { cursor:default; } - - body.corporate { background-image:url(<%= asset_path('corp/bkg_corporate.gif') %>); background-repeat:repeat-x; @@ -115,6 +124,13 @@ body.corporate ul { font-size:20px; } +.wrapper h3 { + font-weight:300; + font-size:16px; + line-height:160%; +} + + #terms-toc a { display:block; } diff --git a/web/app/assets/stylesheets/web/events.css.scss b/web/app/assets/stylesheets/web/events.css.scss new file mode 100644 index 000000000..fadb069e8 --- /dev/null +++ b/web/app/assets/stylesheets/web/events.css.scss @@ -0,0 +1,12 @@ +.landing-band.event { + +} +.landing-details.event { + .time { + margin-bottom:30px; + } + + .bio { + line-height:16px; + } +} \ No newline at end of file diff --git a/web/app/assets/stylesheets/web/web.css b/web/app/assets/stylesheets/web/web.css index 67fb3c22a..d060ec21b 100644 --- a/web/app/assets/stylesheets/web/web.css +++ b/web/app/assets/stylesheets/web/web.css @@ -18,5 +18,6 @@ *= require web/recordings *= require web/welcome #= require web/sessions +*= require web/events *= require users/signinDialog */ \ No newline at end of file diff --git a/web/app/controllers/corps_controller.rb b/web/app/controllers/corps_controller.rb index c5415af19..b81f2fd28 100644 --- a/web/app/controllers/corps_controller.rb +++ b/web/app/controllers/corps_controller.rb @@ -6,11 +6,7 @@ class CorpsController < ApplicationController end - def contact - - end - - def help + def news end @@ -18,11 +14,44 @@ class CorpsController < ApplicationController end + def overview + + end + + def features + + end + + def faqs + + end + + def screenshots + + end + + def photos + + end + + def logos + + end + def testimonials end - def news + def audio + + end + + def videos + + end + + # TODO: FIX THIS + def press_releases_launch end @@ -34,6 +63,10 @@ class CorpsController < ApplicationController end + def help + + end + def cookie_policy end diff --git a/web/app/helpers/event_session_helper.rb b/web/app/helpers/event_session_helper.rb index 89402bd2c..37a67b798 100644 --- a/web/app/helpers/event_session_helper.rb +++ b/web/app/helpers/event_session_helper.rb @@ -33,6 +33,7 @@ module EventSessionHelper end def event_session_start_hour(event_session) + return 'TBD' unless event_session.starts_at timezone = ActiveSupport::TimeZone.new('Central Time (US & Canada)') timezone.at(event_session.starts_at.to_i).strftime('%l:%M %P') end @@ -41,12 +42,12 @@ module EventSessionHelper state = nil # can be :not_started, :over, :playing state = event_session.pinned_state if event_session.pinned_state - if !state && (event_session.user_id || event_session.band_id) + if !state && (event_session.starts_at && event_session.ends_at && (event_session.user_id || event_session.band_id)) # if no pinned state, then we try to find if there is a session currently on going during the specified time range # if so, then we are playing. # if there has been none, we say it's still coming, # if there has been at least one, and it's over, we say session over - query = MusicSessionHistory.where(created_at: event_session.event.event_day..(event_session.event.event_day + 1.day)) + query = MusicSessionHistory.where(created_at: event_session.starts_at..event_session.ends_at) if event_session.user_id query = query.where(user_id: event_session.user_id) elsif event_session.band_id @@ -69,7 +70,7 @@ module EventSessionHelper end if state == 'over' - content_tag(:a, 'SESSION ENDED', href: music_session_detail_path(music_session_history.id), class: 'button-grey') + content_tag(:a, 'SESSION ENDED', href: music_session_history.nil? ? '#' : music_session_detail_path(music_session_history.id), class: 'button-grey') elsif state == 'playing' content_tag(:a, '', href: music_session_detail_path(music_session_history.id), class: 'button-orange') do image_tag 'content/icon_playbutton.png', :width => 20, height: 20, align: 'absmiddle' @@ -84,8 +85,8 @@ module EventSessionHelper end def event_session_description(event_session) - event_session.band.biography if event_session.band - event_session.user.biography if event_session.user + return event_session.band.biography if event_session.band + return event_session.user.biography if event_session.user '' end end diff --git a/web/app/views/corps/audio.html.erb b/web/app/views/corps/audio.html.erb new file mode 100644 index 000000000..7b9876eb4 --- /dev/null +++ b/web/app/views/corps/audio.html.erb @@ -0,0 +1,37 @@ +<% provide(:title, 'Audio Recordings') %> +<% provide(:purpose, 'media_center') %> + +
+ The following audio recordings demonstrate both the quality of the real-time audio that musicians hear in their headphones while playing together using the service, and the quality of the automatically mastered recordings that the service generates. +
+ ++ The recordings below labeled “Real-Time Streamed Recording” are from the musicians’ headphones while playing in real-time. +
+ ++ The recordings below labeled “Mastered Recording” are recordings that the JamKazam service automatically produced by taking the raw audio files captured by the musicians’ audio interfaces and mixing these together as a post process following the actual performance. +
+ + ++ The JamKazam FAQ can be found on our support site here: JamKazam Frequently Asked Questions. +
\ No newline at end of file diff --git a/web/app/views/corps/features.html.erb b/web/app/views/corps/features.html.erb new file mode 100644 index 000000000..10892e941 --- /dev/null +++ b/web/app/views/corps/features.html.erb @@ -0,0 +1,83 @@ +<% provide(:title, 'Features & Benefits') %> +<% provide(:purpose, 'media_center') %> + ++ Musicians can enjoy four major features of the new JamKazam service, as described below. Also, several Tutorial Videos are available to see how various features work in more detail. +
+ ++ Musicians can create either public or private sessions, or can find and join other musicians’ public sessions, and can play music together in real time in these sessions from different locations over the Internet as if they are sitting in the same room. +
+ ++
+ Musicians can record performances during their real-time, remote sessions. Recordings capture both the composite mix of all performers, as well as each of the individual instrumental and vocal performances at the track level. Musicians can easily share the recording mixes with friends, family and fans via Facebook, Twitter, and email, and they can also open and play back the track-level. In addition, the JamKazam service automatically creates a “mastered” version of recordings using the high-quality tracks captured by the musicians’ audio interfaces prior to encoding and streaming, so mastered recordings are comparable in quality to what can be produced in home studios. +
+ ++
+ In addition to recording sessions, musicians can live broadcast their sessions so that family, friends and fans can tune in and listen to these live performances from any location using a computer, tablet or smartphone. Like recordings, live sessions can easily be shared via Facebook, Twitter, or email. +
+ ++
+ Finally, musicians can use JamKazam to find other musicians in their area, check out their skills, styles, and listen to their performances, and connect to play together online and/or offline. +
+ ++ Everyone who plays music knows that it’s far more fun to play with others than to play alone. But many musicians – especially amateur musicians – are not in bands and don’t have established networks of musician friends to play with, simply because of the time and logistical challenges of playing with others, as described earlier. With JamKazam, musicians can easily find other musicians in their area who want to play together online, and who have complementary instruments, skill levels, and musical interests. And they can easily try playing with others without the risk or investment of time to meet in person. +
\ No newline at end of file diff --git a/web/app/views/corps/logos.html.erb b/web/app/views/corps/logos.html.erb new file mode 100644 index 000000000..45691f69a --- /dev/null +++ b/web/app/views/corps/logos.html.erb @@ -0,0 +1,12 @@ +<% provide(:title, 'Logos') %> +<% provide(:purpose, 'media_center') %> + +Following are links to view and download JamKazam logo image files:
+ +
@@ -16,39 +16,38 @@
|
- + |
<%= image_tag("content/icon_users.png", height: '58', width: '58') %>
User Content-+ |
- + |
<%= image_tag("content/icon_pr.png", height: '58', width: '58') %>
Press Releases-- +
|