<commit_before>namespace :db do
  
  desc <<-DESC
  	Drop, create, migrate then seed the database with data for BarcampLondon9
  	This file should contain all the record creation needed to seed the database with its default values.
  	Run using the command 'rake db:load_bcl9
  DESC
  
  task :load_bcberks => [:environment] do
  
  	# Drop the existing database
    Rake::Task['db:drop'].invoke
    
    # Empty caches
    Rake::Task['tmp:cache:clear'].invoke
    Rake::Task['redis:clear_everything'].invoke
    
    # Create a new instance of the database
    Rake::Task['db:create'].invoke    
    Rake::Task['db:migrate'].invoke
	
  	#Firstly lets destroy anything we can find
  	puts "Deleting existing rooms, timeslots, slots and talks."
  	Room.delete_all
  	Timeslot.delete_all
  	Slot.delete_all
  	Talk.delete_all
  	REDIS.keys('*').each do |key| REDIS.del(key) end
  	
  	puts "Total Timeslots: " + Timeslot.all.count.to_s
  	puts "Total Rooms: " + Room.all.count.to_s
  	puts "Total Slots: " + Slot.all.count.to_s
  	puts "Total Talks: " + Talk.all.count.to_s
  	
  	
  	# Generate Rooms
  	puts "Generating rooms."
  	
  	# Room specs: https://geeksoflondon.basecamphq.com/projects/7251895-barcamp-london-9/posts/52762583/comments
  	# Naming scheme: https://geeksoflondon.basecamphq.com/projects/7251895-barcamp-london-9/cat/73463514/posts
  	
  	room_a = Room.create({
	  		:name => 'Everywhere', 
	  		:description => 'Any and all rooms (assuming it\'s not out-of-bounds and there\'s no other talk scheduled in it)', 
	  		:short_code => 'any', 
	  		:capacity => 250, 
	  		:include_in_grid => false
		}, :without_protection => true
  	)
  	room_b = Room.create({
  		:name => 'The Hellmouth', 
  		:description => 'The common room. In the basement, down the stairs and to the left.', 
  		:short_code => 'hel', 
  		:capacity => 250,  
  		:facilities => '',
  		:include_in_grid => false
  		}, :without_protection => true
  	)
  	room1 = Room.create({
  		:name => '0001 Cemetery Lane', 
  		:description => 'Large room in the basement. To your right, behind you as you come down the stairs (near the zombie-infested toilets, practically under the stairs).', 
  		:short_code => 'cem', 
  		:capacity => 60, 
  		:facilities => 'Teaching pod, intermittent Lecture capture'
  		}, :without_protection => true
  	)
  	room2 = Room.create({
  		:name => 'Little Shop of Horrors', 
  		:description => 'Large room in the basement. In front and to your right as you come down the stairs (down the short corridor to the right of the crypt).', 
  		:short_code => 'lsh', 
  		:capacity => 60, 
  		:facilities => 'Teaching pod, intermittent Lecture capture'
  		}, :without_protection => true
  	)
  	room3 = Room.create({
  		:name => '<NAME>', 
  		:description => 'In the basement, to the right of the Help Desk.', 
  		:short_code => 'lkp', 
  		:capacity => 40, 
  		:facilities => 'Teaching pod'
  		}, :without_protection => true
  	)
    room4 = Room.create({
      :name => 'Amityville', 
      :description => 'First floor', 
      :short_code => 'amv', 
      :capacity => 40, 
      :facilities => 'Teaching pod'
      }, :without_protection => true
    )  	
  	room5 = Room.create({
  		:name => 'Island of Lost Souls', 
  		:description => 'First floor.', 
  		:short_code => 'ils', 
  		:capacity => 30, 
  		:facilities => 'Teaching pod'
  		}, :without_protection => true
  	)
  	room6 = Room.create({
  		:name => '<NAME>', 
  		:description => 'First floor.', 
  		:short_code => 'lab', 
  		:capacity => 30,
  		:facilities => 'Teaching pod, Lecture capture'
  		}, :without_protection => true
  	)
  	room7 = Room.create({
  		:name => 'The <NAME>', 
  		:description => 'First floor.', 
  		:short_code => 'blk', 
  		:capacity => 30, 
  		:facilities => 'Teaching pod, intermittent Lecture capture'
  		}, :without_protection => true
  	)
  	room8 = Room.create({
  		:name => 'Burkittsville', 
  		:description => 'Second floor.', 
  		:short_code => 'bkv', 
  		:capacity => 30, 
  		:facilities => 'Teaching pod'
  		}, :without_protection => true
  	)
  	room9 = Room.create({
  		:name => 'Eastwick', 
  		:description => 'Second floor.', 
  		:short_code => 'ewk', 
  		:capacity => 30, 
  		:facilities => 'Teaching pod'
  		}, :without_protection => true
  	)
  	room10 = Room.create({
  		:name => '<NAME>', 
  		:description => 'Second floor.', 
  		:short_code => 'slh', 
  		:capacity => 30, 
  		:facilities => 'Teaching pod'
  		}, :without_protection => true
  	)
  	
  	puts "Total Rooms: " + Room.all.count.to_s
  	puts "ID of first Room: " + Room.all.first.id.to_s
  	
	
  	#Generate Timeslots
  	puts "Generating timeslots."
  	predetermined_talks = Array.new
  	timeslots_to_lock = Array.new
  	
  	##Opening Talk
  	
  	start_time = Time.utc(2012, "jul", 7,9,30,00)
  	end_time = start_time + 30.minutes
  	timeslot_label = 'Opening Talk'
  	timeslot = Timeslot.create({:name => timeslot_label, :start => start_time, :end => end_time}, :without_protection => true)
  	predetermined_talks << [timeslot, room_b, "Welcome to Barcamp Berkshire!", "The Crew", true]
  	timeslots_to_lock << timeslot
  	
  	
  	## Grid Population
  	
  	start_time = end_time
  	end_time = start_time + 20.minutes
  	timeslot_label = 'Grid Population'
  	timeslot = Timeslot.create({:name => timeslot_label, :start => start_time, :end => end_time}, :without_protection => true)
  	predetermined_talks << [timeslot, room_a, "Add your talk to the grid", "You", true]
  	timeslots_to_lock << timeslot<commit_msg>Updated the BCB seed file with room data and potential naming scheme.<commit_after>namespace :db do
  
  desc <<-DESC
  	Drop, create, migrate then seed the database with data for BarcampLondon9
  	This file should contain all the record creation needed to seed the database with its default values.
  	Run using the command 'rake db:load_bcl9
  DESC
  
  task :load_bcberks => [:environment] do
  
  	# Drop the existing database
    Rake::Task['db:drop'].invoke
    
    # Empty caches
    Rake::Task['tmp:cache:clear'].invoke
    Rake::Task['redis:clear_everything'].invoke
    
    # Create a new instance of the database
    Rake::Task['db:create'].invoke    
    Rake::Task['db:migrate'].invoke
	
  	#Firstly lets destroy anything we can find
  	puts "Deleting existing rooms, timeslots, slots and talks."
  	Room.delete_all
  	Timeslot.delete_all
  	Slot.delete_all
  	Talk.delete_all
  	REDIS.keys('*').each do |key| REDIS.del(key) end
  	
  	puts "Total Timeslots: " + Timeslot.all.count.to_s
  	puts "Total Rooms: " + Room.all.count.to_s
  	puts "Total Slots: " + Slot.all.count.to_s
  	puts "Total Talks: " + Talk.all.count.to_s
  	
  	
  	# Generate Rooms
  	puts "Generating rooms."
  	
  	# Room specs: https://geeksoflondon.basecamphq.com/projects/7251895-barcamp-london-9/posts/52762583/comments
  	# Naming scheme: https://geeksoflondon.basecamphq.com/projects/7251895-barcamp-london-9/cat/73463514/posts
  	
  	room_a = Room.create({
	  		:name => 'Everywhere', 
	  		:description => 'Any and all rooms (assuming it\'s not out-of-bounds and there\'s no other talk scheduled in it)', 
	  		:short_code => 'any', 
	  		:capacity => 250, 
	  		:include_in_grid => false
		}, :without_protection => true
  	)
  	room_b = Room.create({
  		:name => 'Windsor Great Park', 
  		:description => 'The common room. On the top floor.', 
  		:short_code => 'PRk', 
  		:capacity => 1,  
  		:facilities => '[details required]',
  		:include_in_grid => false
  		}, :without_protection => true
  	)
  	room1 = Room.create({
  		:name => '<NAME> ', 
  		:description => '[description and directions required]', 
  		:short_code => 'ATR', 
  		:capacity => 1, 
  		:facilities => '[details required]'
  		}, :without_protection => true
  	)
  	room2 = Room.create({
  		:name => '<NAME>', 
  		:description => '[description and directions required]',  
  		:short_code => 'CAS', 
  		:capacity => 1, 
  		:facilities => '[details required]'
  		}, :without_protection => true
  	)
  	room3 = Room.create({
  		:name => '<NAME>', 
  		:description => '[description and directions required]',  
  		:short_code => 'DON', 
  		:capacity => 1,  
  		:facilities => '[details required]',
  		}, :without_protection => true
  	)
    room4 = Room.create({
      :name => 'Frogmore', 
      :description => '[description and directions required]', 
      :short_code => 'FRG', 
  		:capacity => 1,  
  		:facilities => '[details required]',
      }, :without_protection => true
    )  	
  	room5 = Room.create({
  		:name => '<NAME>', 
  		:description => '[description and directions required]', 
  		:short_code => 'GIB', 
  		:capacity => 1,  
  		:facilities => '[details required]',
  		}, :without_protection => true
  	)
  	room6 = Room.create({
  		:name => '<NAME>', 
  		:description => '[description and directions required]', 
  		:short_code => 'GRN', 
  		:capacity => 1,  
  		:facilities => '[details required]',
  		}, :without_protection => true
  	)
  	room7 = Room.create({
  		:name => '<NAME>', 
  		:description => '[description and directions required]', 
  		:short_code => 'GAP', 
  		:capacity => 1,  
  		:facilities => '[details required]',
  		}, :without_protection => true
  	)
  	room8 = Room.create({
  		:name => '<NAME>', 
  		:description => '[description and directions required]', 
  		:short_code => 'HOL', 
  		:capacity => 1,  
  		:facilities => '[details required]',
  		}, :without_protection => true
  	)
  	room9 = Room.create({
  		:name => '<NAME>', 
  		:description => '[description and directions required]', 
  		:short_code => 'LAR', 
  		:capacity => 1,  
  		:facilities => '[details required]',
  		}, :without_protection => true
  	)
  	room10 = Room.create({
  		:name => '<NAME>', 
  		:description => '[description and directions required]', 
  		:short_code => 'LOK', 
  		:capacity => 1,  
  		:facilities => '[details required]',
  		}, :without_protection => true
  	)
  	room11 = Room.create({
  		:name => '<NAME>', 
  		:description => '[description and directions required]', 
  		:short_code => 'LOU', 
  		:capacity => 1,  
  		:facilities => '[details required]',
  		}, :without_protection => true
  	)  	
  	room12 = Room.create({
  		:name => '<NAME>', 
  		:description => '[description and directions required]', 
  		:short_code => 'RID', 
  		:capacity => 1,  
  		:facilities => '[details required]',
  		}, :without_protection => true
  	)  	
  	room13 = Room.create({
  		:name => '<NAME>', 
  		:description => '[description and directions required]', 
  		:short_code => 'WAL', 
  		:capacity => 1,  
  		:facilities => '[details required]',
  		}, :without_protection => true
  	)
  	room14 = Room.create({
  		:name => '<NAME>', 
  		:description => '[description and directions required]', 
  		:short_code => 'WAT', 
  		:capacity => 1,  
  		:facilities => '[details required]',
  		}, :without_protection => true
  	)  	
  	
  	puts "Total Rooms: " + Room.all.count.to_s
  	puts "ID of first Room: " + Room.all.first.id.to_s
  	
	
  	#Generate Timeslots
  	puts "Generating timeslots."
  	predetermined_talks = Array.new
  	timeslots_to_lock = Array.new
  	
  	##Opening Talk
  	
  	start_time = Time.utc(2012, "jul", 7,9,30,00)
  	end_time = start_time + 30.minutes
  	timeslot_label = 'Opening Talk'
  	timeslot = Timeslot.create({:name => timeslot_label, :start => start_time, :end => end_time}, :without_protection => true)
  	predetermined_talks << [timeslot, room_b, "Welcome to Barcamp Berkshire!", "The Crew", true]
  	timeslots_to_lock << timeslot
  	
  	
  	## Grid Population
  	
  	start_time = end_time
  	end_time = start_time + 20.minutes
  	timeslot_label = 'Grid Population'
  	timeslot = Timeslot.create({:name => timeslot_label, :start => start_time, :end => end_time}, :without_protection => true)
  	predetermined_talks << [timeslot, room_a, "Add your talk to the grid", "You", true]
  	timeslots_to_lock << timeslot
{'fraction_non_alphanumeric': 0.14417049728374426, 'fraction_numerical': 0.014542415378186378, 'mean_word_length': 2.9820299500831946, 'pattern_counts': {'":': 0, '<': 40, '<?xml version=': 0, '>': 208, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2332023', 'n_tokens_mistral': 4585, 'n_tokens_neox': 4277, 'n_words': 1002}