From f5956e949699e8db56774e0338d7228c3289ec1e Mon Sep 17 00:00:00 2001 From: tkimia Date: Thu, 24 Apr 2014 13:19:41 -0400 Subject: small visual fixes --- app/assets/stylesheets/custom.css.scss | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/assets/stylesheets/custom.css.scss b/app/assets/stylesheets/custom.css.scss index 4104235..b456893 100644 --- a/app/assets/stylesheets/custom.css.scss +++ b/app/assets/stylesheets/custom.css.scss @@ -36,13 +36,14 @@ a, input[type="submit"] { } -input[type="text"], input[type="password"]{ +input[type="text"], input[type="password"], textarea{ -webkit-box-shadow: inset 0 0 8px rgba(0,0,0,0.1), 0 0 16px rgba(0,0,0,0.1); -moz-box-shadow: inset 0 0 8px rgba(0,0,0,0.1), 0 0 16px rgba(0,0,0,0.1); box-shadow: inset 0 0 8px rgba(0,0,0,0.1), 0 0 16px rgba(0,0,0,0.1); border: 3px inset #A5A5A5; padding: 8px; + color: $orange !important; background: rgba(0,0,0,0.5); margin: 0 0 5px 0; } -- cgit v1.1-4-g5e80 From 66aed81910ba84e829ecc9c0d11bed104c4283d0 Mon Sep 17 00:00:00 2001 From: tkimia Date: Thu, 24 Apr 2014 16:20:21 -0400 Subject: math wizardry --- lib/scheduling/elimination.rb | 56 ++++++++++++++++++++++++------------------- 1 file changed, 32 insertions(+), 24 deletions(-) diff --git a/lib/scheduling/elimination.rb b/lib/scheduling/elimination.rb index 1ac696d..ca48f14 100644 --- a/lib/scheduling/elimination.rb +++ b/lib/scheduling/elimination.rb @@ -51,10 +51,16 @@ module Scheduling def graph(current_user) matches = @tournament_stage.matches_ordered + numTeams = @tournament_stage.tournament.min_teams_per_match + logBase = numTeams + # depth of SVG tree - depth = Math.log2(matches.count).floor+1; + depth = Math.log(matches.count*(logBase-1),logBase).floor+1; + # height of SVG - height = [200 * 2**Math.log2(matches.count).floor + 100, 500].max; + matchHeight = 50*logBase; + height = [(matchHeight+50) * logBase**(depth-1) + 100, 500].max; + lastrx = 0 lastry = 0 lastrh = 0 @@ -73,10 +79,12 @@ module Scheduling STRING (1..matches.count).each do |i| - rh = 100/(2**(depth-1)+1) - 5 + matchDepth = Math.log(i*(logBase-1), logBase).floor+1 + base = (logBase**(matchDepth-1)/(logBase-1)).ceil + rh = 100 / (logBase**(depth-1)+1) - 100/height; rw = 100/(depth+1) - 5 - rx = 50/(depth+1) + 100/(depth+1)*(depth-(Math.log2(i).floor+1)) - ry = ( 100/(2**(Math.log2(i).floor)+1) + rh * 1.1 * (2**Math.log2(i).ceil-i)) + rx = 50/(depth+1) + 100/(depth+1)*(depth-matchDepth) + ry = 100/(logBase**(matchDepth-1)+1) * (i-base+1) - rh/2 str += "\t\n" str += "\t\t\n" - if matches[i].teams.first - str += "\t\tTeam #{matches[i].teams.first.id}\n" - end - - str += "\t\t VS \n" + str += "/>\n" - color = (matches[i].teams[1] and matches[i].teams[1].users.include?(current_user)) ? "#BCED91" : "white" - str += "\t\t\n" - if matches[i].teams[1] - str += "\t\tTeam #{matches[i].teams[1].id}\n" + t = 1 + while t <= numTeams + color = (matches[i].teams[t-1] and matches[i].teams[t-1].users.include?(current_user)) ? "#BCED91" : "white" + str += "\t\t\n" + if matches[i].teams[t-1] + str += "\t\tTeam #{matches[i].teams[t-1].id}\n" + end + if (t < numTeams) + str += "\t\t VS \n" + end + t = t + 1 end if i > 1 - str += "\t\t\n" - end - if Math.log2(i+1) == Math.log2(i+1).ceil - lastrx = rx - lastry = ry - lastrh = rh - lastrw = rw + parent = (i+logBase-2)/logBase + pDepth = Math.log(parent*(logBase-1), logBase).floor+1 + pBase = (logBase**(pDepth-1)/(logBase-1)).ceil + lastrx = 50/(depth+1) + 100/(depth+1)*(depth-pDepth) + lastry = 100/(logBase**(pDepth-1)+1) * (parent-pBase+1) - rh/2 + str += "\t\t\n" end str += "\n" end @@ -126,5 +133,6 @@ STRING return str end + end end -- cgit v1.1-4-g5e80 From a05373ca55332c239d303cc83dfa8b2ab95e88b3 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Thu, 24 Apr 2014 16:25:32 -0400 Subject: oops, model names need to be singular --- generate.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generate.sh b/generate.sh index 8e29384..be2e1a1 100755 --- a/generate.sh +++ b/generate.sh @@ -61,7 +61,7 @@ bundle exec rails generate model remote_username game:references user:references bundle exec rails generate model bracket_match bracket:references match:references predicted_winner:references -bundle exec rails generate model api_requests api_name:string +bundle exec rails generate model api_request api_name:string # Join tables bundle exec rails generate migration CreateTournamentPlayersJoinTable players tournaments -- cgit v1.1-4-g5e80 From ae9a64f4e2e7a654e28744f1c8ca98681bb70301 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Thu, 24 Apr 2014 16:28:14 -0400 Subject: run ./generate.sh --- app/models/api_request.rb | 2 + app/models/api_requests.rb | 2 - .../20140423214420_create_simple_captcha_data.rb | 15 ------ ...0424014418_create_mailboxer.mailboxer_engine.rb | 62 ---------------------- ...4014419_add_notified_object.mailboxer_engine.rb | 18 ------- ...14420_add_notification_code.mailboxer_engine.rb | 14 ----- ...40424014421_add_attachments.mailboxer_engine.rb | 10 ---- ...014422_rename_receipts_read.mailboxer_engine.rb | 10 ---- ...global_notification_support.mailboxer_engine.rb | 10 ---- db/migrate/20140424014424_create_delayed_jobs.rb | 22 -------- db/migrate/20140424014425_create_servers.rb | 9 ---- db/migrate/20140424014426_create_matches.rb | 13 ----- db/migrate/20140424014427_create_teams.rb | 8 --- db/migrate/20140424014428_create_alerts.rb | 10 ---- db/migrate/20140424014429_create_pms.rb | 11 ---- db/migrate/20140424014431_create_tournaments.rb | 19 ------- db/migrate/20140424014433_create_games.rb | 18 ------- db/migrate/20140424014434_create_users.rb | 13 ----- db/migrate/20140424014436_create_sessions.rb | 11 ---- db/migrate/20140424014437_create_brackets.rb | 11 ---- db/migrate/20140424014439_create_game_settings.rb | 15 ------ .../20140424014440_create_tournament_settings.rb | 15 ------ .../20140424014442_create_tournament_stages.rb | 11 ---- db/migrate/20140424014443_create_statistics.rb | 12 ----- .../20140424014445_create_remote_usernames.rb | 11 ---- .../20140424014446_create_bracket_matches.rb | 11 ---- db/migrate/20140424014448_create_api_requests.rb | 9 ---- ...4014449_create_tournament_players_join_table.rb | 8 --- ...424014451_create_tournament_hosts_join_table.rb | 8 --- .../20140424014452_create_team_user_join_table.rb | 8 --- .../20140424014454_create_match_team_join_table.rb | 8 --- .../20140424014459_add_hidden_attrs_to_user.rb | 6 --- .../20140424162546_create_simple_captcha_data.rb | 15 ++++++ ...0424202542_create_mailboxer.mailboxer_engine.rb | 62 ++++++++++++++++++++++ ...4202543_add_notified_object.mailboxer_engine.rb | 18 +++++++ ...02544_add_notification_code.mailboxer_engine.rb | 14 +++++ ...40424202545_add_attachments.mailboxer_engine.rb | 10 ++++ ...202546_rename_receipts_read.mailboxer_engine.rb | 10 ++++ ...global_notification_support.mailboxer_engine.rb | 10 ++++ db/migrate/20140424202549_create_delayed_jobs.rb | 22 ++++++++ db/migrate/20140424202553_create_servers.rb | 9 ++++ db/migrate/20140424202557_create_matches.rb | 13 +++++ db/migrate/20140424202600_create_teams.rb | 8 +++ db/migrate/20140424202604_create_alerts.rb | 10 ++++ db/migrate/20140424202608_create_pms.rb | 11 ++++ db/migrate/20140424202611_create_tournaments.rb | 19 +++++++ db/migrate/20140424202615_create_games.rb | 18 +++++++ db/migrate/20140424202619_create_users.rb | 13 +++++ db/migrate/20140424202623_create_sessions.rb | 11 ++++ db/migrate/20140424202626_create_brackets.rb | 11 ++++ db/migrate/20140424202630_create_game_settings.rb | 15 ++++++ .../20140424202634_create_tournament_settings.rb | 15 ++++++ .../20140424202638_create_tournament_stages.rb | 11 ++++ db/migrate/20140424202641_create_statistics.rb | 12 +++++ .../20140424202645_create_remote_usernames.rb | 11 ++++ .../20140424202649_create_bracket_matches.rb | 11 ++++ db/migrate/20140424202652_create_api_requests.rb | 9 ++++ ...4202656_create_tournament_players_join_table.rb | 8 +++ ...424202659_create_tournament_hosts_join_table.rb | 8 +++ .../20140424202703_create_team_user_join_table.rb | 8 +++ .../20140424202706_create_match_team_join_table.rb | 8 +++ .../20140424202717_add_hidden_attrs_to_user.rb | 6 +++ db/schema.rb | 2 +- test/models/api_request_test.rb | 7 +++ test/models/api_requests_test.rb | 7 --- 65 files changed, 416 insertions(+), 416 deletions(-) create mode 100644 app/models/api_request.rb delete mode 100644 app/models/api_requests.rb delete mode 100644 db/migrate/20140423214420_create_simple_captcha_data.rb delete mode 100644 db/migrate/20140424014418_create_mailboxer.mailboxer_engine.rb delete mode 100644 db/migrate/20140424014419_add_notified_object.mailboxer_engine.rb delete mode 100644 db/migrate/20140424014420_add_notification_code.mailboxer_engine.rb delete mode 100644 db/migrate/20140424014421_add_attachments.mailboxer_engine.rb delete mode 100644 db/migrate/20140424014422_rename_receipts_read.mailboxer_engine.rb delete mode 100644 db/migrate/20140424014423_add_global_notification_support.mailboxer_engine.rb delete mode 100644 db/migrate/20140424014424_create_delayed_jobs.rb delete mode 100644 db/migrate/20140424014425_create_servers.rb delete mode 100644 db/migrate/20140424014426_create_matches.rb delete mode 100644 db/migrate/20140424014427_create_teams.rb delete mode 100644 db/migrate/20140424014428_create_alerts.rb delete mode 100644 db/migrate/20140424014429_create_pms.rb delete mode 100644 db/migrate/20140424014431_create_tournaments.rb delete mode 100644 db/migrate/20140424014433_create_games.rb delete mode 100644 db/migrate/20140424014434_create_users.rb delete mode 100644 db/migrate/20140424014436_create_sessions.rb delete mode 100644 db/migrate/20140424014437_create_brackets.rb delete mode 100644 db/migrate/20140424014439_create_game_settings.rb delete mode 100644 db/migrate/20140424014440_create_tournament_settings.rb delete mode 100644 db/migrate/20140424014442_create_tournament_stages.rb delete mode 100644 db/migrate/20140424014443_create_statistics.rb delete mode 100644 db/migrate/20140424014445_create_remote_usernames.rb delete mode 100644 db/migrate/20140424014446_create_bracket_matches.rb delete mode 100644 db/migrate/20140424014448_create_api_requests.rb delete mode 100644 db/migrate/20140424014449_create_tournament_players_join_table.rb delete mode 100644 db/migrate/20140424014451_create_tournament_hosts_join_table.rb delete mode 100644 db/migrate/20140424014452_create_team_user_join_table.rb delete mode 100644 db/migrate/20140424014454_create_match_team_join_table.rb delete mode 100644 db/migrate/20140424014459_add_hidden_attrs_to_user.rb create mode 100644 db/migrate/20140424162546_create_simple_captcha_data.rb create mode 100644 db/migrate/20140424202542_create_mailboxer.mailboxer_engine.rb create mode 100644 db/migrate/20140424202543_add_notified_object.mailboxer_engine.rb create mode 100644 db/migrate/20140424202544_add_notification_code.mailboxer_engine.rb create mode 100644 db/migrate/20140424202545_add_attachments.mailboxer_engine.rb create mode 100644 db/migrate/20140424202546_rename_receipts_read.mailboxer_engine.rb create mode 100644 db/migrate/20140424202547_add_global_notification_support.mailboxer_engine.rb create mode 100644 db/migrate/20140424202549_create_delayed_jobs.rb create mode 100644 db/migrate/20140424202553_create_servers.rb create mode 100644 db/migrate/20140424202557_create_matches.rb create mode 100644 db/migrate/20140424202600_create_teams.rb create mode 100644 db/migrate/20140424202604_create_alerts.rb create mode 100644 db/migrate/20140424202608_create_pms.rb create mode 100644 db/migrate/20140424202611_create_tournaments.rb create mode 100644 db/migrate/20140424202615_create_games.rb create mode 100644 db/migrate/20140424202619_create_users.rb create mode 100644 db/migrate/20140424202623_create_sessions.rb create mode 100644 db/migrate/20140424202626_create_brackets.rb create mode 100644 db/migrate/20140424202630_create_game_settings.rb create mode 100644 db/migrate/20140424202634_create_tournament_settings.rb create mode 100644 db/migrate/20140424202638_create_tournament_stages.rb create mode 100644 db/migrate/20140424202641_create_statistics.rb create mode 100644 db/migrate/20140424202645_create_remote_usernames.rb create mode 100644 db/migrate/20140424202649_create_bracket_matches.rb create mode 100644 db/migrate/20140424202652_create_api_requests.rb create mode 100644 db/migrate/20140424202656_create_tournament_players_join_table.rb create mode 100644 db/migrate/20140424202659_create_tournament_hosts_join_table.rb create mode 100644 db/migrate/20140424202703_create_team_user_join_table.rb create mode 100644 db/migrate/20140424202706_create_match_team_join_table.rb create mode 100644 db/migrate/20140424202717_add_hidden_attrs_to_user.rb create mode 100644 test/models/api_request_test.rb delete mode 100644 test/models/api_requests_test.rb diff --git a/app/models/api_request.rb b/app/models/api_request.rb new file mode 100644 index 0000000..ffb7267 --- /dev/null +++ b/app/models/api_request.rb @@ -0,0 +1,2 @@ +class ApiRequest < ActiveRecord::Base +end diff --git a/app/models/api_requests.rb b/app/models/api_requests.rb deleted file mode 100644 index 19c76e2..0000000 --- a/app/models/api_requests.rb +++ /dev/null @@ -1,2 +0,0 @@ -class ApiRequests < ActiveRecord::Base -end diff --git a/db/migrate/20140423214420_create_simple_captcha_data.rb b/db/migrate/20140423214420_create_simple_captcha_data.rb deleted file mode 100644 index 4573b20..0000000 --- a/db/migrate/20140423214420_create_simple_captcha_data.rb +++ /dev/null @@ -1,15 +0,0 @@ -class CreateSimpleCaptchaData < ActiveRecord::Migration - def self.up - create_table :simple_captcha_data do |t| - t.string :key, :limit => 40 - t.string :value, :limit => 6 - t.timestamps - end - - add_index :simple_captcha_data, :key, :name => "idx_key" - end - - def self.down - drop_table :simple_captcha_data - end -end diff --git a/db/migrate/20140424014418_create_mailboxer.mailboxer_engine.rb b/db/migrate/20140424014418_create_mailboxer.mailboxer_engine.rb deleted file mode 100644 index 690cec2..0000000 --- a/db/migrate/20140424014418_create_mailboxer.mailboxer_engine.rb +++ /dev/null @@ -1,62 +0,0 @@ -# This migration comes from mailboxer_engine (originally 20110511145103) -class CreateMailboxer < ActiveRecord::Migration - def self.up - #Tables - #Conversations - create_table :conversations do |t| - t.column :subject, :string, :default => "" - t.column :created_at, :datetime, :null => false - t.column :updated_at, :datetime, :null => false - end - #Receipts - create_table :receipts do |t| - t.references :receiver, :polymorphic => true - t.column :notification_id, :integer, :null => false - t.column :read, :boolean, :default => false - t.column :trashed, :boolean, :default => false - t.column :deleted, :boolean, :default => false - t.column :mailbox_type, :string, :limit => 25 - t.column :created_at, :datetime, :null => false - t.column :updated_at, :datetime, :null => false - end - #Notifications and Messages - create_table :notifications do |t| - t.column :type, :string - t.column :body, :text - t.column :subject, :string, :default => "" - t.references :sender, :polymorphic => true - t.references :object, :polymorphic => true - t.column :conversation_id, :integer - t.column :draft, :boolean, :default => false - t.column :updated_at, :datetime, :null => false - t.column :created_at, :datetime, :null => false - end - - - #Indexes - #Conversations - #Receipts - add_index "receipts","notification_id" - - #Messages - add_index "notifications","conversation_id" - - #Foreign keys - #Conversations - #Receipts - add_foreign_key "receipts", "notifications", :name => "receipts_on_notification_id" - #Messages - add_foreign_key "notifications", "conversations", :name => "notifications_on_conversation_id" - end - - def self.down - #Tables - remove_foreign_key "receipts", :name => "receipts_on_notification_id" - remove_foreign_key "notifications", :name => "notifications_on_conversation_id" - - #Indexes - drop_table :receipts - drop_table :conversations - drop_table :notifications - end -end diff --git a/db/migrate/20140424014419_add_notified_object.mailboxer_engine.rb b/db/migrate/20140424014419_add_notified_object.mailboxer_engine.rb deleted file mode 100644 index 7f41ac6..0000000 --- a/db/migrate/20140424014419_add_notified_object.mailboxer_engine.rb +++ /dev/null @@ -1,18 +0,0 @@ -# This migration comes from mailboxer_engine (originally 20110719110700) -class AddNotifiedObject < ActiveRecord::Migration - def self.up - change_table :notifications do |t| - t.references :notified_object, :polymorphic => true - t.remove :object_id - t.remove :object_type - end - end - - def self.down - change_table :notifications do |t| - t.remove :notified_object_id - t.remove :notified_object_type - t.references :object, :polymorphic => true - end - end -end diff --git a/db/migrate/20140424014420_add_notification_code.mailboxer_engine.rb b/db/migrate/20140424014420_add_notification_code.mailboxer_engine.rb deleted file mode 100644 index 04c12ef..0000000 --- a/db/migrate/20140424014420_add_notification_code.mailboxer_engine.rb +++ /dev/null @@ -1,14 +0,0 @@ -# This migration comes from mailboxer_engine (originally 20110912163911) -class AddNotificationCode < ActiveRecord::Migration - def self.up - change_table :notifications do |t| - t.string :notification_code, :default => nil - end - end - - def self.down - change_table :notifications do |t| - t.remove :notification_code - end - end -end \ No newline at end of file diff --git a/db/migrate/20140424014421_add_attachments.mailboxer_engine.rb b/db/migrate/20140424014421_add_attachments.mailboxer_engine.rb deleted file mode 100644 index b8d6588..0000000 --- a/db/migrate/20140424014421_add_attachments.mailboxer_engine.rb +++ /dev/null @@ -1,10 +0,0 @@ -# This migration comes from mailboxer_engine (originally 20111204163911) -class AddAttachments < ActiveRecord::Migration - def self.up - add_column :notifications, :attachment, :string - end - - def self.down - remove_column :notifications, :attachment - end -end diff --git a/db/migrate/20140424014422_rename_receipts_read.mailboxer_engine.rb b/db/migrate/20140424014422_rename_receipts_read.mailboxer_engine.rb deleted file mode 100644 index 9ce904f..0000000 --- a/db/migrate/20140424014422_rename_receipts_read.mailboxer_engine.rb +++ /dev/null @@ -1,10 +0,0 @@ -# This migration comes from mailboxer_engine (originally 20120813110712) -class RenameReceiptsRead < ActiveRecord::Migration - def up - rename_column :receipts, :read, :is_read - end - - def down - rename_column :receipts, :is_read, :read - end -end diff --git a/db/migrate/20140424014423_add_global_notification_support.mailboxer_engine.rb b/db/migrate/20140424014423_add_global_notification_support.mailboxer_engine.rb deleted file mode 100644 index 60f67ab..0000000 --- a/db/migrate/20140424014423_add_global_notification_support.mailboxer_engine.rb +++ /dev/null @@ -1,10 +0,0 @@ -# This migration comes from mailboxer_engine (originally 20130305144212) -class AddGlobalNotificationSupport < ActiveRecord::Migration - - def change - change_table :notifications do |t| - t.boolean :global, default: false - t.datetime :expires - end - end -end diff --git a/db/migrate/20140424014424_create_delayed_jobs.rb b/db/migrate/20140424014424_create_delayed_jobs.rb deleted file mode 100644 index ec0dd93..0000000 --- a/db/migrate/20140424014424_create_delayed_jobs.rb +++ /dev/null @@ -1,22 +0,0 @@ -class CreateDelayedJobs < ActiveRecord::Migration - def self.up - create_table :delayed_jobs, :force => true do |table| - table.integer :priority, :default => 0, :null => false # Allows some jobs to jump to the front of the queue - table.integer :attempts, :default => 0, :null => false # Provides for retries, but still fail eventually. - table.text :handler, :null => false # YAML-encoded string of the object that will do work - table.text :last_error # reason for last failure (See Note below) - table.datetime :run_at # When to run. Could be Time.zone.now for immediately, or sometime in the future. - table.datetime :locked_at # Set when a client is working on this object - table.datetime :failed_at # Set when all retries have failed (actually, by default, the record is deleted instead) - table.string :locked_by # Who is working on this object (if locked) - table.string :queue # The name of the queue this job is in - table.timestamps - end - - add_index :delayed_jobs, [:priority, :run_at], :name => 'delayed_jobs_priority' - end - - def self.down - drop_table :delayed_jobs - end -end diff --git a/db/migrate/20140424014425_create_servers.rb b/db/migrate/20140424014425_create_servers.rb deleted file mode 100644 index fbe1b02..0000000 --- a/db/migrate/20140424014425_create_servers.rb +++ /dev/null @@ -1,9 +0,0 @@ -class CreateServers < ActiveRecord::Migration - def change - create_table :servers do |t| - t.integer :default_user_permissions - - t.timestamps - end - end -end diff --git a/db/migrate/20140424014426_create_matches.rb b/db/migrate/20140424014426_create_matches.rb deleted file mode 100644 index bac92d1..0000000 --- a/db/migrate/20140424014426_create_matches.rb +++ /dev/null @@ -1,13 +0,0 @@ -class CreateMatches < ActiveRecord::Migration - def change - create_table :matches do |t| - t.integer :status - t.references :tournament_stage, index: true - t.references :winner, index: true - t.text :remote_id - t.integer :submitted_peer_evaluations - - t.timestamps - end - end -end diff --git a/db/migrate/20140424014427_create_teams.rb b/db/migrate/20140424014427_create_teams.rb deleted file mode 100644 index dd8397d..0000000 --- a/db/migrate/20140424014427_create_teams.rb +++ /dev/null @@ -1,8 +0,0 @@ -class CreateTeams < ActiveRecord::Migration - def change - create_table :teams do |t| - - t.timestamps - end - end -end diff --git a/db/migrate/20140424014428_create_alerts.rb b/db/migrate/20140424014428_create_alerts.rb deleted file mode 100644 index 68a8e10..0000000 --- a/db/migrate/20140424014428_create_alerts.rb +++ /dev/null @@ -1,10 +0,0 @@ -class CreateAlerts < ActiveRecord::Migration - def change - create_table :alerts do |t| - t.references :author, index: true - t.text :message - - t.timestamps - end - end -end diff --git a/db/migrate/20140424014429_create_pms.rb b/db/migrate/20140424014429_create_pms.rb deleted file mode 100644 index 93bb5c6..0000000 --- a/db/migrate/20140424014429_create_pms.rb +++ /dev/null @@ -1,11 +0,0 @@ -class CreatePms < ActiveRecord::Migration - def change - create_table :pms do |t| - t.references :author, index: true - t.references :recipient, index: true - t.text :message - - t.timestamps - end - end -end diff --git a/db/migrate/20140424014431_create_tournaments.rb b/db/migrate/20140424014431_create_tournaments.rb deleted file mode 100644 index 716871f..0000000 --- a/db/migrate/20140424014431_create_tournaments.rb +++ /dev/null @@ -1,19 +0,0 @@ -class CreateTournaments < ActiveRecord::Migration - def change - create_table :tournaments do |t| - t.references :game, index: true - t.integer :status - t.string :name - t.integer :min_players_per_team - t.integer :max_players_per_team - t.integer :min_teams_per_match - t.integer :max_teams_per_match - t.integer :set_rounds - t.boolean :randomized_teams - t.string :sampling_method - - t.timestamps - end - add_index :tournaments, :name, unique: true - end -end diff --git a/db/migrate/20140424014433_create_games.rb b/db/migrate/20140424014433_create_games.rb deleted file mode 100644 index 23edf0b..0000000 --- a/db/migrate/20140424014433_create_games.rb +++ /dev/null @@ -1,18 +0,0 @@ -class CreateGames < ActiveRecord::Migration - def change - create_table :games do |t| - t.references :parent, index: true - t.string :name - t.integer :min_players_per_team - t.integer :max_players_per_team - t.integer :min_teams_per_match - t.integer :max_teams_per_match - t.integer :set_rounds - t.boolean :randomized_teams - t.string :sampling_method - - t.timestamps - end - add_index :games, :name, unique: true - end -end diff --git a/db/migrate/20140424014434_create_users.rb b/db/migrate/20140424014434_create_users.rb deleted file mode 100644 index 8032870..0000000 --- a/db/migrate/20140424014434_create_users.rb +++ /dev/null @@ -1,13 +0,0 @@ -class CreateUsers < ActiveRecord::Migration - def change - create_table :users do |t| - t.string :name - t.string :email - t.string :user_name - - t.timestamps - end - add_index :users, :email, unique: true - add_index :users, :user_name, unique: true - end -end diff --git a/db/migrate/20140424014436_create_sessions.rb b/db/migrate/20140424014436_create_sessions.rb deleted file mode 100644 index f667f1e..0000000 --- a/db/migrate/20140424014436_create_sessions.rb +++ /dev/null @@ -1,11 +0,0 @@ -class CreateSessions < ActiveRecord::Migration - def change - create_table :sessions do |t| - t.references :user, index: true - t.string :token - - t.timestamps - end - add_index :sessions, :token, unique: true - end -end diff --git a/db/migrate/20140424014437_create_brackets.rb b/db/migrate/20140424014437_create_brackets.rb deleted file mode 100644 index 8813bf2..0000000 --- a/db/migrate/20140424014437_create_brackets.rb +++ /dev/null @@ -1,11 +0,0 @@ -class CreateBrackets < ActiveRecord::Migration - def change - create_table :brackets do |t| - t.references :user, index: true - t.references :tournament, index: true - t.string :name - - t.timestamps - end - end -end diff --git a/db/migrate/20140424014439_create_game_settings.rb b/db/migrate/20140424014439_create_game_settings.rb deleted file mode 100644 index 06fb72e..0000000 --- a/db/migrate/20140424014439_create_game_settings.rb +++ /dev/null @@ -1,15 +0,0 @@ -class CreateGameSettings < ActiveRecord::Migration - def change - create_table :game_settings do |t| - t.references :game, index: true - t.string :name - t.integer :vartype - t.text :type_opt - t.text :description - t.integer :display_order - t.text :default - - t.timestamps - end - end -end diff --git a/db/migrate/20140424014440_create_tournament_settings.rb b/db/migrate/20140424014440_create_tournament_settings.rb deleted file mode 100644 index e56697f..0000000 --- a/db/migrate/20140424014440_create_tournament_settings.rb +++ /dev/null @@ -1,15 +0,0 @@ -class CreateTournamentSettings < ActiveRecord::Migration - def change - create_table :tournament_settings do |t| - t.references :tournament, index: true - t.string :name - t.integer :vartype - t.text :type_opt - t.text :description - t.integer :display_order - t.text :value - - t.timestamps - end - end -end diff --git a/db/migrate/20140424014442_create_tournament_stages.rb b/db/migrate/20140424014442_create_tournament_stages.rb deleted file mode 100644 index e3668cb..0000000 --- a/db/migrate/20140424014442_create_tournament_stages.rb +++ /dev/null @@ -1,11 +0,0 @@ -class CreateTournamentStages < ActiveRecord::Migration - def change - create_table :tournament_stages do |t| - t.references :tournament, index: true - t.string :scheduling - t.text :structure - - t.timestamps - end - end -end diff --git a/db/migrate/20140424014443_create_statistics.rb b/db/migrate/20140424014443_create_statistics.rb deleted file mode 100644 index cc2e97d..0000000 --- a/db/migrate/20140424014443_create_statistics.rb +++ /dev/null @@ -1,12 +0,0 @@ -class CreateStatistics < ActiveRecord::Migration - def change - create_table :statistics do |t| - t.references :user, index: true - t.references :match, index: true - t.string :name - t.integer :value - - t.timestamps - end - end -end diff --git a/db/migrate/20140424014445_create_remote_usernames.rb b/db/migrate/20140424014445_create_remote_usernames.rb deleted file mode 100644 index e265985..0000000 --- a/db/migrate/20140424014445_create_remote_usernames.rb +++ /dev/null @@ -1,11 +0,0 @@ -class CreateRemoteUsernames < ActiveRecord::Migration - def change - create_table :remote_usernames do |t| - t.references :game, index: true - t.references :user, index: true - t.text :json_value - - t.timestamps - end - end -end diff --git a/db/migrate/20140424014446_create_bracket_matches.rb b/db/migrate/20140424014446_create_bracket_matches.rb deleted file mode 100644 index 3323e31..0000000 --- a/db/migrate/20140424014446_create_bracket_matches.rb +++ /dev/null @@ -1,11 +0,0 @@ -class CreateBracketMatches < ActiveRecord::Migration - def change - create_table :bracket_matches do |t| - t.references :bracket, index: true - t.references :match, index: true - t.references :predicted_winner, index: true - - t.timestamps - end - end -end diff --git a/db/migrate/20140424014448_create_api_requests.rb b/db/migrate/20140424014448_create_api_requests.rb deleted file mode 100644 index 544c330..0000000 --- a/db/migrate/20140424014448_create_api_requests.rb +++ /dev/null @@ -1,9 +0,0 @@ -class CreateApiRequests < ActiveRecord::Migration - def change - create_table :api_requests do |t| - t.string :api_name - - t.timestamps - end - end -end diff --git a/db/migrate/20140424014449_create_tournament_players_join_table.rb b/db/migrate/20140424014449_create_tournament_players_join_table.rb deleted file mode 100644 index be240e8..0000000 --- a/db/migrate/20140424014449_create_tournament_players_join_table.rb +++ /dev/null @@ -1,8 +0,0 @@ -class CreateTournamentPlayersJoinTable < ActiveRecord::Migration - def change - create_join_table :players, :tournaments do |t| - # t.index [:player_id, :tournament_id] - # t.index [:tournament_id, :player_id] - end - end -end diff --git a/db/migrate/20140424014451_create_tournament_hosts_join_table.rb b/db/migrate/20140424014451_create_tournament_hosts_join_table.rb deleted file mode 100644 index 7521d89..0000000 --- a/db/migrate/20140424014451_create_tournament_hosts_join_table.rb +++ /dev/null @@ -1,8 +0,0 @@ -class CreateTournamentHostsJoinTable < ActiveRecord::Migration - def change - create_join_table :hosts, :tournaments do |t| - # t.index [:host_id, :tournament_id] - # t.index [:tournament_id, :host_id] - end - end -end diff --git a/db/migrate/20140424014452_create_team_user_join_table.rb b/db/migrate/20140424014452_create_team_user_join_table.rb deleted file mode 100644 index f3b57fc..0000000 --- a/db/migrate/20140424014452_create_team_user_join_table.rb +++ /dev/null @@ -1,8 +0,0 @@ -class CreateTeamUserJoinTable < ActiveRecord::Migration - def change - create_join_table :teams, :users do |t| - # t.index [:team_id, :user_id] - # t.index [:user_id, :team_id] - end - end -end diff --git a/db/migrate/20140424014454_create_match_team_join_table.rb b/db/migrate/20140424014454_create_match_team_join_table.rb deleted file mode 100644 index c2ed1b7..0000000 --- a/db/migrate/20140424014454_create_match_team_join_table.rb +++ /dev/null @@ -1,8 +0,0 @@ -class CreateMatchTeamJoinTable < ActiveRecord::Migration - def change - create_join_table :matches, :teams do |t| - # t.index [:match_id, :team_id] - # t.index [:team_id, :match_id] - end - end -end diff --git a/db/migrate/20140424014459_add_hidden_attrs_to_user.rb b/db/migrate/20140424014459_add_hidden_attrs_to_user.rb deleted file mode 100644 index 9b5c505..0000000 --- a/db/migrate/20140424014459_add_hidden_attrs_to_user.rb +++ /dev/null @@ -1,6 +0,0 @@ -class AddHiddenAttrsToUser < ActiveRecord::Migration - def change - add_column :users, :password_digest, :string - add_column :users, :permissions, :integer - end -end diff --git a/db/migrate/20140424162546_create_simple_captcha_data.rb b/db/migrate/20140424162546_create_simple_captcha_data.rb new file mode 100644 index 0000000..4573b20 --- /dev/null +++ b/db/migrate/20140424162546_create_simple_captcha_data.rb @@ -0,0 +1,15 @@ +class CreateSimpleCaptchaData < ActiveRecord::Migration + def self.up + create_table :simple_captcha_data do |t| + t.string :key, :limit => 40 + t.string :value, :limit => 6 + t.timestamps + end + + add_index :simple_captcha_data, :key, :name => "idx_key" + end + + def self.down + drop_table :simple_captcha_data + end +end diff --git a/db/migrate/20140424202542_create_mailboxer.mailboxer_engine.rb b/db/migrate/20140424202542_create_mailboxer.mailboxer_engine.rb new file mode 100644 index 0000000..690cec2 --- /dev/null +++ b/db/migrate/20140424202542_create_mailboxer.mailboxer_engine.rb @@ -0,0 +1,62 @@ +# This migration comes from mailboxer_engine (originally 20110511145103) +class CreateMailboxer < ActiveRecord::Migration + def self.up + #Tables + #Conversations + create_table :conversations do |t| + t.column :subject, :string, :default => "" + t.column :created_at, :datetime, :null => false + t.column :updated_at, :datetime, :null => false + end + #Receipts + create_table :receipts do |t| + t.references :receiver, :polymorphic => true + t.column :notification_id, :integer, :null => false + t.column :read, :boolean, :default => false + t.column :trashed, :boolean, :default => false + t.column :deleted, :boolean, :default => false + t.column :mailbox_type, :string, :limit => 25 + t.column :created_at, :datetime, :null => false + t.column :updated_at, :datetime, :null => false + end + #Notifications and Messages + create_table :notifications do |t| + t.column :type, :string + t.column :body, :text + t.column :subject, :string, :default => "" + t.references :sender, :polymorphic => true + t.references :object, :polymorphic => true + t.column :conversation_id, :integer + t.column :draft, :boolean, :default => false + t.column :updated_at, :datetime, :null => false + t.column :created_at, :datetime, :null => false + end + + + #Indexes + #Conversations + #Receipts + add_index "receipts","notification_id" + + #Messages + add_index "notifications","conversation_id" + + #Foreign keys + #Conversations + #Receipts + add_foreign_key "receipts", "notifications", :name => "receipts_on_notification_id" + #Messages + add_foreign_key "notifications", "conversations", :name => "notifications_on_conversation_id" + end + + def self.down + #Tables + remove_foreign_key "receipts", :name => "receipts_on_notification_id" + remove_foreign_key "notifications", :name => "notifications_on_conversation_id" + + #Indexes + drop_table :receipts + drop_table :conversations + drop_table :notifications + end +end diff --git a/db/migrate/20140424202543_add_notified_object.mailboxer_engine.rb b/db/migrate/20140424202543_add_notified_object.mailboxer_engine.rb new file mode 100644 index 0000000..7f41ac6 --- /dev/null +++ b/db/migrate/20140424202543_add_notified_object.mailboxer_engine.rb @@ -0,0 +1,18 @@ +# This migration comes from mailboxer_engine (originally 20110719110700) +class AddNotifiedObject < ActiveRecord::Migration + def self.up + change_table :notifications do |t| + t.references :notified_object, :polymorphic => true + t.remove :object_id + t.remove :object_type + end + end + + def self.down + change_table :notifications do |t| + t.remove :notified_object_id + t.remove :notified_object_type + t.references :object, :polymorphic => true + end + end +end diff --git a/db/migrate/20140424202544_add_notification_code.mailboxer_engine.rb b/db/migrate/20140424202544_add_notification_code.mailboxer_engine.rb new file mode 100644 index 0000000..04c12ef --- /dev/null +++ b/db/migrate/20140424202544_add_notification_code.mailboxer_engine.rb @@ -0,0 +1,14 @@ +# This migration comes from mailboxer_engine (originally 20110912163911) +class AddNotificationCode < ActiveRecord::Migration + def self.up + change_table :notifications do |t| + t.string :notification_code, :default => nil + end + end + + def self.down + change_table :notifications do |t| + t.remove :notification_code + end + end +end \ No newline at end of file diff --git a/db/migrate/20140424202545_add_attachments.mailboxer_engine.rb b/db/migrate/20140424202545_add_attachments.mailboxer_engine.rb new file mode 100644 index 0000000..b8d6588 --- /dev/null +++ b/db/migrate/20140424202545_add_attachments.mailboxer_engine.rb @@ -0,0 +1,10 @@ +# This migration comes from mailboxer_engine (originally 20111204163911) +class AddAttachments < ActiveRecord::Migration + def self.up + add_column :notifications, :attachment, :string + end + + def self.down + remove_column :notifications, :attachment + end +end diff --git a/db/migrate/20140424202546_rename_receipts_read.mailboxer_engine.rb b/db/migrate/20140424202546_rename_receipts_read.mailboxer_engine.rb new file mode 100644 index 0000000..9ce904f --- /dev/null +++ b/db/migrate/20140424202546_rename_receipts_read.mailboxer_engine.rb @@ -0,0 +1,10 @@ +# This migration comes from mailboxer_engine (originally 20120813110712) +class RenameReceiptsRead < ActiveRecord::Migration + def up + rename_column :receipts, :read, :is_read + end + + def down + rename_column :receipts, :is_read, :read + end +end diff --git a/db/migrate/20140424202547_add_global_notification_support.mailboxer_engine.rb b/db/migrate/20140424202547_add_global_notification_support.mailboxer_engine.rb new file mode 100644 index 0000000..60f67ab --- /dev/null +++ b/db/migrate/20140424202547_add_global_notification_support.mailboxer_engine.rb @@ -0,0 +1,10 @@ +# This migration comes from mailboxer_engine (originally 20130305144212) +class AddGlobalNotificationSupport < ActiveRecord::Migration + + def change + change_table :notifications do |t| + t.boolean :global, default: false + t.datetime :expires + end + end +end diff --git a/db/migrate/20140424202549_create_delayed_jobs.rb b/db/migrate/20140424202549_create_delayed_jobs.rb new file mode 100644 index 0000000..ec0dd93 --- /dev/null +++ b/db/migrate/20140424202549_create_delayed_jobs.rb @@ -0,0 +1,22 @@ +class CreateDelayedJobs < ActiveRecord::Migration + def self.up + create_table :delayed_jobs, :force => true do |table| + table.integer :priority, :default => 0, :null => false # Allows some jobs to jump to the front of the queue + table.integer :attempts, :default => 0, :null => false # Provides for retries, but still fail eventually. + table.text :handler, :null => false # YAML-encoded string of the object that will do work + table.text :last_error # reason for last failure (See Note below) + table.datetime :run_at # When to run. Could be Time.zone.now for immediately, or sometime in the future. + table.datetime :locked_at # Set when a client is working on this object + table.datetime :failed_at # Set when all retries have failed (actually, by default, the record is deleted instead) + table.string :locked_by # Who is working on this object (if locked) + table.string :queue # The name of the queue this job is in + table.timestamps + end + + add_index :delayed_jobs, [:priority, :run_at], :name => 'delayed_jobs_priority' + end + + def self.down + drop_table :delayed_jobs + end +end diff --git a/db/migrate/20140424202553_create_servers.rb b/db/migrate/20140424202553_create_servers.rb new file mode 100644 index 0000000..fbe1b02 --- /dev/null +++ b/db/migrate/20140424202553_create_servers.rb @@ -0,0 +1,9 @@ +class CreateServers < ActiveRecord::Migration + def change + create_table :servers do |t| + t.integer :default_user_permissions + + t.timestamps + end + end +end diff --git a/db/migrate/20140424202557_create_matches.rb b/db/migrate/20140424202557_create_matches.rb new file mode 100644 index 0000000..bac92d1 --- /dev/null +++ b/db/migrate/20140424202557_create_matches.rb @@ -0,0 +1,13 @@ +class CreateMatches < ActiveRecord::Migration + def change + create_table :matches do |t| + t.integer :status + t.references :tournament_stage, index: true + t.references :winner, index: true + t.text :remote_id + t.integer :submitted_peer_evaluations + + t.timestamps + end + end +end diff --git a/db/migrate/20140424202600_create_teams.rb b/db/migrate/20140424202600_create_teams.rb new file mode 100644 index 0000000..dd8397d --- /dev/null +++ b/db/migrate/20140424202600_create_teams.rb @@ -0,0 +1,8 @@ +class CreateTeams < ActiveRecord::Migration + def change + create_table :teams do |t| + + t.timestamps + end + end +end diff --git a/db/migrate/20140424202604_create_alerts.rb b/db/migrate/20140424202604_create_alerts.rb new file mode 100644 index 0000000..68a8e10 --- /dev/null +++ b/db/migrate/20140424202604_create_alerts.rb @@ -0,0 +1,10 @@ +class CreateAlerts < ActiveRecord::Migration + def change + create_table :alerts do |t| + t.references :author, index: true + t.text :message + + t.timestamps + end + end +end diff --git a/db/migrate/20140424202608_create_pms.rb b/db/migrate/20140424202608_create_pms.rb new file mode 100644 index 0000000..93bb5c6 --- /dev/null +++ b/db/migrate/20140424202608_create_pms.rb @@ -0,0 +1,11 @@ +class CreatePms < ActiveRecord::Migration + def change + create_table :pms do |t| + t.references :author, index: true + t.references :recipient, index: true + t.text :message + + t.timestamps + end + end +end diff --git a/db/migrate/20140424202611_create_tournaments.rb b/db/migrate/20140424202611_create_tournaments.rb new file mode 100644 index 0000000..716871f --- /dev/null +++ b/db/migrate/20140424202611_create_tournaments.rb @@ -0,0 +1,19 @@ +class CreateTournaments < ActiveRecord::Migration + def change + create_table :tournaments do |t| + t.references :game, index: true + t.integer :status + t.string :name + t.integer :min_players_per_team + t.integer :max_players_per_team + t.integer :min_teams_per_match + t.integer :max_teams_per_match + t.integer :set_rounds + t.boolean :randomized_teams + t.string :sampling_method + + t.timestamps + end + add_index :tournaments, :name, unique: true + end +end diff --git a/db/migrate/20140424202615_create_games.rb b/db/migrate/20140424202615_create_games.rb new file mode 100644 index 0000000..23edf0b --- /dev/null +++ b/db/migrate/20140424202615_create_games.rb @@ -0,0 +1,18 @@ +class CreateGames < ActiveRecord::Migration + def change + create_table :games do |t| + t.references :parent, index: true + t.string :name + t.integer :min_players_per_team + t.integer :max_players_per_team + t.integer :min_teams_per_match + t.integer :max_teams_per_match + t.integer :set_rounds + t.boolean :randomized_teams + t.string :sampling_method + + t.timestamps + end + add_index :games, :name, unique: true + end +end diff --git a/db/migrate/20140424202619_create_users.rb b/db/migrate/20140424202619_create_users.rb new file mode 100644 index 0000000..8032870 --- /dev/null +++ b/db/migrate/20140424202619_create_users.rb @@ -0,0 +1,13 @@ +class CreateUsers < ActiveRecord::Migration + def change + create_table :users do |t| + t.string :name + t.string :email + t.string :user_name + + t.timestamps + end + add_index :users, :email, unique: true + add_index :users, :user_name, unique: true + end +end diff --git a/db/migrate/20140424202623_create_sessions.rb b/db/migrate/20140424202623_create_sessions.rb new file mode 100644 index 0000000..f667f1e --- /dev/null +++ b/db/migrate/20140424202623_create_sessions.rb @@ -0,0 +1,11 @@ +class CreateSessions < ActiveRecord::Migration + def change + create_table :sessions do |t| + t.references :user, index: true + t.string :token + + t.timestamps + end + add_index :sessions, :token, unique: true + end +end diff --git a/db/migrate/20140424202626_create_brackets.rb b/db/migrate/20140424202626_create_brackets.rb new file mode 100644 index 0000000..8813bf2 --- /dev/null +++ b/db/migrate/20140424202626_create_brackets.rb @@ -0,0 +1,11 @@ +class CreateBrackets < ActiveRecord::Migration + def change + create_table :brackets do |t| + t.references :user, index: true + t.references :tournament, index: true + t.string :name + + t.timestamps + end + end +end diff --git a/db/migrate/20140424202630_create_game_settings.rb b/db/migrate/20140424202630_create_game_settings.rb new file mode 100644 index 0000000..06fb72e --- /dev/null +++ b/db/migrate/20140424202630_create_game_settings.rb @@ -0,0 +1,15 @@ +class CreateGameSettings < ActiveRecord::Migration + def change + create_table :game_settings do |t| + t.references :game, index: true + t.string :name + t.integer :vartype + t.text :type_opt + t.text :description + t.integer :display_order + t.text :default + + t.timestamps + end + end +end diff --git a/db/migrate/20140424202634_create_tournament_settings.rb b/db/migrate/20140424202634_create_tournament_settings.rb new file mode 100644 index 0000000..e56697f --- /dev/null +++ b/db/migrate/20140424202634_create_tournament_settings.rb @@ -0,0 +1,15 @@ +class CreateTournamentSettings < ActiveRecord::Migration + def change + create_table :tournament_settings do |t| + t.references :tournament, index: true + t.string :name + t.integer :vartype + t.text :type_opt + t.text :description + t.integer :display_order + t.text :value + + t.timestamps + end + end +end diff --git a/db/migrate/20140424202638_create_tournament_stages.rb b/db/migrate/20140424202638_create_tournament_stages.rb new file mode 100644 index 0000000..e3668cb --- /dev/null +++ b/db/migrate/20140424202638_create_tournament_stages.rb @@ -0,0 +1,11 @@ +class CreateTournamentStages < ActiveRecord::Migration + def change + create_table :tournament_stages do |t| + t.references :tournament, index: true + t.string :scheduling + t.text :structure + + t.timestamps + end + end +end diff --git a/db/migrate/20140424202641_create_statistics.rb b/db/migrate/20140424202641_create_statistics.rb new file mode 100644 index 0000000..cc2e97d --- /dev/null +++ b/db/migrate/20140424202641_create_statistics.rb @@ -0,0 +1,12 @@ +class CreateStatistics < ActiveRecord::Migration + def change + create_table :statistics do |t| + t.references :user, index: true + t.references :match, index: true + t.string :name + t.integer :value + + t.timestamps + end + end +end diff --git a/db/migrate/20140424202645_create_remote_usernames.rb b/db/migrate/20140424202645_create_remote_usernames.rb new file mode 100644 index 0000000..e265985 --- /dev/null +++ b/db/migrate/20140424202645_create_remote_usernames.rb @@ -0,0 +1,11 @@ +class CreateRemoteUsernames < ActiveRecord::Migration + def change + create_table :remote_usernames do |t| + t.references :game, index: true + t.references :user, index: true + t.text :json_value + + t.timestamps + end + end +end diff --git a/db/migrate/20140424202649_create_bracket_matches.rb b/db/migrate/20140424202649_create_bracket_matches.rb new file mode 100644 index 0000000..3323e31 --- /dev/null +++ b/db/migrate/20140424202649_create_bracket_matches.rb @@ -0,0 +1,11 @@ +class CreateBracketMatches < ActiveRecord::Migration + def change + create_table :bracket_matches do |t| + t.references :bracket, index: true + t.references :match, index: true + t.references :predicted_winner, index: true + + t.timestamps + end + end +end diff --git a/db/migrate/20140424202652_create_api_requests.rb b/db/migrate/20140424202652_create_api_requests.rb new file mode 100644 index 0000000..544c330 --- /dev/null +++ b/db/migrate/20140424202652_create_api_requests.rb @@ -0,0 +1,9 @@ +class CreateApiRequests < ActiveRecord::Migration + def change + create_table :api_requests do |t| + t.string :api_name + + t.timestamps + end + end +end diff --git a/db/migrate/20140424202656_create_tournament_players_join_table.rb b/db/migrate/20140424202656_create_tournament_players_join_table.rb new file mode 100644 index 0000000..be240e8 --- /dev/null +++ b/db/migrate/20140424202656_create_tournament_players_join_table.rb @@ -0,0 +1,8 @@ +class CreateTournamentPlayersJoinTable < ActiveRecord::Migration + def change + create_join_table :players, :tournaments do |t| + # t.index [:player_id, :tournament_id] + # t.index [:tournament_id, :player_id] + end + end +end diff --git a/db/migrate/20140424202659_create_tournament_hosts_join_table.rb b/db/migrate/20140424202659_create_tournament_hosts_join_table.rb new file mode 100644 index 0000000..7521d89 --- /dev/null +++ b/db/migrate/20140424202659_create_tournament_hosts_join_table.rb @@ -0,0 +1,8 @@ +class CreateTournamentHostsJoinTable < ActiveRecord::Migration + def change + create_join_table :hosts, :tournaments do |t| + # t.index [:host_id, :tournament_id] + # t.index [:tournament_id, :host_id] + end + end +end diff --git a/db/migrate/20140424202703_create_team_user_join_table.rb b/db/migrate/20140424202703_create_team_user_join_table.rb new file mode 100644 index 0000000..f3b57fc --- /dev/null +++ b/db/migrate/20140424202703_create_team_user_join_table.rb @@ -0,0 +1,8 @@ +class CreateTeamUserJoinTable < ActiveRecord::Migration + def change + create_join_table :teams, :users do |t| + # t.index [:team_id, :user_id] + # t.index [:user_id, :team_id] + end + end +end diff --git a/db/migrate/20140424202706_create_match_team_join_table.rb b/db/migrate/20140424202706_create_match_team_join_table.rb new file mode 100644 index 0000000..c2ed1b7 --- /dev/null +++ b/db/migrate/20140424202706_create_match_team_join_table.rb @@ -0,0 +1,8 @@ +class CreateMatchTeamJoinTable < ActiveRecord::Migration + def change + create_join_table :matches, :teams do |t| + # t.index [:match_id, :team_id] + # t.index [:team_id, :match_id] + end + end +end diff --git a/db/migrate/20140424202717_add_hidden_attrs_to_user.rb b/db/migrate/20140424202717_add_hidden_attrs_to_user.rb new file mode 100644 index 0000000..9b5c505 --- /dev/null +++ b/db/migrate/20140424202717_add_hidden_attrs_to_user.rb @@ -0,0 +1,6 @@ +class AddHiddenAttrsToUser < ActiveRecord::Migration + def change + add_column :users, :password_digest, :string + add_column :users, :permissions, :integer + end +end diff --git a/db/schema.rb b/db/schema.rb index 0e9202a..0833263 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20140424014459) do +ActiveRecord::Schema.define(version: 20140424202717) do create_table "alerts", force: true do |t| t.integer "author_id" diff --git a/test/models/api_request_test.rb b/test/models/api_request_test.rb new file mode 100644 index 0000000..ea37ce4 --- /dev/null +++ b/test/models/api_request_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class ApiRequestTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/models/api_requests_test.rb b/test/models/api_requests_test.rb deleted file mode 100644 index 18763a7..0000000 --- a/test/models/api_requests_test.rb +++ /dev/null @@ -1,7 +0,0 @@ -require 'test_helper' - -class ApiRequestsTest < ActiveSupport::TestCase - # test "the truth" do - # assert true - # end -end -- cgit v1.1-4-g5e80 From 992dc06e50d74aca79ed58d868be6113e3ebe55c Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Thu, 24 Apr 2014 16:58:57 -0400 Subject: do away with stages_ordered --- app/models/tournament.rb | 10 ---------- app/views/matches/index.html.erb | 7 +++---- 2 files changed, 3 insertions(+), 14 deletions(-) diff --git a/app/models/tournament.rb b/app/models/tournament.rb index e21ccb1..caa711c 100644 --- a/app/models/tournament.rb +++ b/app/models/tournament.rb @@ -5,16 +5,6 @@ class Tournament < ActiveRecord::Base has_and_belongs_to_many :players, class_name: "User", association_foreign_key: "player_id", join_table: "players_tournaments" has_and_belongs_to_many :hosts, class_name: "User", association_foreign_key: "host_id", join_table: "hosts_tournaments" - def stages_ordered - h = {} - i = 1 - self.tournament_stages.order(:id).each do |s| - h[i] = s - i += 1 - end - return h - end - def settings @settings ||= Settings.new(self) end diff --git a/app/views/matches/index.html.erb b/app/views/matches/index.html.erb index 8a50fee..d8538df 100644 --- a/app/views/matches/index.html.erb +++ b/app/views/matches/index.html.erb @@ -12,8 +12,7 @@ - <% @tournament.stages_ordered.keys.sort.each do |stage_key| %> - <% stage = @tournament.stages_ordered[stage_key] %> + <% @tournament.tournament_stages.ordered(:id)each do |stage| %> <% stage.matches_ordered.keys.sort.reverse.each do |match_key| %> <% match = stage.matches_ordered[match_key] %> <%= "Match #{match.id}" %> @@ -36,6 +35,6 @@
-<% @tournament.stages_ordered.keys.sort.each do |stage_key| %> -
<%= raw @tournament.stages_ordered[stage_key].to_svg(current_user) %>
+<% @tournament.tournament_stages.ordered(:id).each do |stage| %> +
<%= raw stage.to_svg(current_user) %>
<% end %> -- cgit v1.1-4-g5e80 From 27c3e207b299e6c5a94a1ab81412bb9e11a0d92a Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Thu, 24 Apr 2014 17:01:42 -0400 Subject: rename Tournament#tournament_stages to Tournament#stages --- app/controllers/tournaments_controller.rb | 4 ++-- app/models/tournament.rb | 2 +- app/views/matches/index.html.erb | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/controllers/tournaments_controller.rb b/app/controllers/tournaments_controller.rb index ebc54c1..1354ad6 100644 --- a/app/controllers/tournaments_controller.rb +++ b/app/controllers/tournaments_controller.rb @@ -116,8 +116,8 @@ class TournamentsController < ApplicationController success = true ActiveRecord::Base.transaction do success &= @tournament.save && - success &= @tournament.tournament_stages.create(scheduling: "elimination") - success &= @tournament.tournament_stages.first.create_matches + success &= @tournament.stages.create(scheduling: "elimination") + success &= @tournament.stages.first.create_matches end if success format.html { redirect_to @tournament, notice: 'You have started this tournament.' } diff --git a/app/models/tournament.rb b/app/models/tournament.rb index caa711c..861be6c 100644 --- a/app/models/tournament.rb +++ b/app/models/tournament.rb @@ -1,6 +1,6 @@ class Tournament < ActiveRecord::Base belongs_to :game - has_many :tournament_stages + has_many :stages, class_name: "TournamentStage" has_many :settings_raw, class_name: "TournamentSetting" has_and_belongs_to_many :players, class_name: "User", association_foreign_key: "player_id", join_table: "players_tournaments" has_and_belongs_to_many :hosts, class_name: "User", association_foreign_key: "host_id", join_table: "hosts_tournaments" diff --git a/app/views/matches/index.html.erb b/app/views/matches/index.html.erb index d8538df..761f12a 100644 --- a/app/views/matches/index.html.erb +++ b/app/views/matches/index.html.erb @@ -12,7 +12,7 @@ - <% @tournament.tournament_stages.ordered(:id)each do |stage| %> + <% @tournament.stages.ordered(:id)each do |stage| %> <% stage.matches_ordered.keys.sort.reverse.each do |match_key| %> <% match = stage.matches_ordered[match_key] %> <%= "Match #{match.id}" %> @@ -35,6 +35,6 @@
-<% @tournament.tournament_stages.ordered(:id).each do |stage| %> +<% @tournament.stages.ordered(:id).each do |stage| %>
<%= raw stage.to_svg(current_user) %>
<% end %> -- cgit v1.1-4-g5e80 From dd9a7a6b55fd3a6a494ba41fc133b1f1056c66a9 Mon Sep 17 00:00:00 2001 From: tkimia Date: Thu, 24 Apr 2014 17:10:24 -0400 Subject: fixed an off-by-one error when moving teams into matches --- lib/scheduling/elimination.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/scheduling/elimination.rb b/lib/scheduling/elimination.rb index ca48f14..e66a29a 100644 --- a/lib/scheduling/elimination.rb +++ b/lib/scheduling/elimination.rb @@ -32,7 +32,7 @@ module Scheduling # if the match is full, move to the next match, otherwise move to the next team if (team_num == self.tournament.min_teams_per_match) match_num -= 1 - team_num = 0 + team_num = 1 else team_num += 1 end -- cgit v1.1-4-g5e80 From 976325f60e7706e480f3d45848897200734c8485 Mon Sep 17 00:00:00 2001 From: tkimia Date: Thu, 24 Apr 2014 17:46:09 -0400 Subject: luke's typo fix --- app/views/matches/index.html.erb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/matches/index.html.erb b/app/views/matches/index.html.erb index 761f12a..784d7db 100644 --- a/app/views/matches/index.html.erb +++ b/app/views/matches/index.html.erb @@ -12,7 +12,7 @@ - <% @tournament.stages.ordered(:id)each do |stage| %> + <% @tournament.stages.order(:id).each do |stage| %> <% stage.matches_ordered.keys.sort.reverse.each do |match_key| %> <% match = stage.matches_ordered[match_key] %> <%= "Match #{match.id}" %> @@ -35,6 +35,6 @@
-<% @tournament.stages.ordered(:id).each do |stage| %> +<% @tournament.stages.order(:id).each do |stage| %>
<%= raw stage.to_svg(current_user) %>
<% end %> -- cgit v1.1-4-g5e80 From 7fe1894becda038c3e85ba179dc27ce3b54690dc Mon Sep 17 00:00:00 2001 From: guntasgrewal Date: Thu, 24 Apr 2014 17:57:59 -0400 Subject: I am Guntas and I added a bunch of seeds such as: players, tournaments, and other stuff. Dont hit enter --- db/seeds.rb | 78 ++++++++++++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 65 insertions(+), 13 deletions(-) diff --git a/db/seeds.rb b/db/seeds.rb index 7b8709c..7f066bc 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -16,18 +16,32 @@ Game.create(name: "Rock, Paper, Scissors", min_players_per_team: 1, max_players_ Game.find_by_name("League of Legends").settings.create(name: "Map", default: "Summoners Rift", type_opt: "Summoners Rift,Twisted Treeline,Crystal Scar,Haunted Abyss", description: "Select a map to play on.", vartype: 5, display_order: 1) Game.find_by_name("League of Legends").settings.create(name: "Pick Type", type_opt: "Blind Pick,Draft", description: "Select a pick type.", vartype: 5, display_order: 2) +Game.find_by_name("League of Legends").settings.create(name: "Scoring Method", type_opt: "FibonacciPeerWithBlowout,MarginalPeer,WinnerTakesAll", description: "Select Scoring Method", vartype: 5, display_order: 3) +Game.find_by_name("League of Legends").settings.create(name: "Seeding Method", type_opt: "Manual,Random,MultiStage", description: "Select Seeding Method", vartype: 5, display_order: 4) +Game.find_by_name("League of Legends").settings.create(name: "Scheduling Method", type_opt: "Elimination,RoundRobin", description: "Select Scheduling Method", vartype: 5, display_order: 5) Game.find_by_name("Chess").settings.create(name: "Time Control", description: "Enter a value for Time Control (ie. 5-5, 30, 6hr, or None)", vartype: 0, display_order: 1) +Game.find_by_name("Chess").settings.create(name: "Scoring Method", type_opt: "WinnerTakesAll", description: "Select Scoring Method", vartype: 5, display_order: 2) +Game.find_by_name("Chess").settings.create(name: "Seeding Method", type_opt: "Manual,Random,MultiStage", description: "Select Seeding Method", vartype: 5, display_order: 3) +Game.find_by_name("Chess").settings.create(name: "Scheduling Method", type_opt: "Elimination,RoundRobin", description: "Select Scheduling Method", vartype: 5, display_order: 4) Game.find_by_name("Hearthstone").settings.create(name: "Deck Name", description: "Enter a name for your deck, be descriptive.", vartype: 1, display_order: 1) +Game.find_by_name("Hearthstone").settings.create(name: "Scoring Method", type_opt: "WinnerTakesAll", description: "Select Scoring Method", vartype: 5, display_order: 2) +Game.find_by_name("Hearthstone").settings.create(name: "Seeding Method", type_opt: "Manual,Random,MultiStage", description: "Select Seeding Method", vartype: 5, display_order: 3) +Game.find_by_name("Hearthstone").settings.create(name: "Scheduling Method", type_opt: "Elimination,RoundRobin", description: "Select Scheduling Method", vartype: 5, display_order: 4) -Game.find_by_name("Rock, Paper, Scissors").settings.create(name: "Favorite Object", description: "What is your favorite object in RPS?", type_opt: "Rock,Paper,Scissors", vartype: 2, display_order: 2) -Game.find_by_name("Rock, Paper, Scissors").settings.create(name: "Lizard, Spock allowed?", description: "Will you allow Lizard and Spock?", vartype: 4, display_order: 1) -Game.find_by_name("Rock, Paper, Scissors").settings.create(name: "Why are those up there even called radio buttons?", description: "Check boxes make sense at least", type_opt: "I do not know.,There is now spoon.,Wow.,Because electricity.,Wat?", vartype: 3, display_order: 3) +Game.find_by_name("Rock, Paper, Scissors").settings.create(name: "Favorite Object", description: "What is your favorite object in RPS?", type_opt: "Rock,Paper,Scissors", vartype: 2, display_order: 5) +Game.find_by_name("Rock, Paper, Scissors").settings.create(name: "Lizard, Spock allowed?", description: "Will you allow Lizard and Spock?", vartype: 4, display_order: 4) +Game.find_by_name("Rock, Paper, Scissors").settings.create(name: "Why are those up there even called radio buttons?", description: "Check boxes make sense at least", type_opt: "I do not know.,There is now spoon.,Wow.,Because electricity.,Wat?", vartype: 3, display_order: 6) +Game.find_by_name("Rock, Paper, Scissors").settings.create(name: "Scoring Method", type_opt: "WinnerTakesAll", description: "Select Scoring Method", vartype: 5, display_order: 1) +Game.find_by_name("Rock, Paper, Scissors").settings.create(name: "Seeding Method", type_opt: "Manual,Random,MultiStage", description: "Select Seeding Method", vartype: 5, display_order: 2) +Game.find_by_name("Rock, Paper, Scissors").settings.create(name: "Scheduling Method", type_opt: "Elimination,RoundRobin", description: "Select Scheduling Method", vartype: 5, display_order: 3) if Rails.env.development? + #user 1, the ADMIN User.create(name: "Administrator", user_name: "admin", email: "root@localhost.lan", password: "password", password_confirmation: "password", permissions: 0xFFFFFFFF) + #john doe's for testing User.create(name: "John 0", password: "password", email: "john0@gmail.com", user_name: "johndoe0", password_confirmation: "password") User.create(name: "John 1", password: "password", email: "john1@gmail.com", user_name: "johndoe1", password_confirmation: "password") User.create(name: "John 2", password: "password", email: "john2@gmail.com", user_name: "johndoe2", password_confirmation: "password") @@ -39,14 +53,52 @@ if Rails.env.development? User.create(name: "John 8", password: "password", email: "john8@gmail.com", user_name: "johndoe8", password_confirmation: "password") User.create(name: "John 9", password: "password", email: "john9@gmail.com", user_name: "johndoe9", password_confirmation: "password") - User.create(name: "Sytrie", password: "password", email: "Sytrie@gmail.com", user_name: "Sytrie", password_confirmation: "password") - User.create(name: "Derpanator115", password: "password", email: "Derpanator115@gmail.com", user_name: "Derpanator115", password_confirmation: "password") - User.create(name: "Wlknexe56", password: "password", email: "Wlknexe56@gmail.com", user_name: "Wlknexe56", password_confirmation: "password") - User.create(name: "DVisionzz", password: "password", email: "DVisionzz@gmail.com", user_name: "DVisionzz", password_confirmation: "password") - User.create(name: "HYP3RTONIC", password: "password", email: "HYP3RTONIC@gmail.com", user_name: "HYP3RTONIC", password_confirmation: "password") - User.create(name: "M9Fumjaa", password: "password", email: "M9Fumjaa@gmail.com", user_name: "M9Fumjaa", password_confirmation: "password") - User.create(name: "spikevsnaruto", password: "password", email: "spikevsnaruto@gmail.com", user_name: "spikevsnaruto", password_confirmation: "password") - User.create(name: "GoogleMaSkills", password: "password", email: "GoogleMaSkills@gmail.com", user_name: "GoogleMaSkills", password_confirmation: "password") - User.create(name: "james chamberlan", password: "password", email: "james chamberlan@gmail.com", user_name: "james chamberlan", password_confirmation: "password") - User.create(name: "Kaceytron", password: "password", email: "Kaceytron@gmail.com", user_name: "Kaceytron", password_confirmation: "password") + players_for_league = Array.new + + #users for our fake seeded game from the yamls + players_for_league.push(User.create(name: "Sytrie", password: "password", email: "Sytrie@gmail.com", user_name: "Sytrie", password_confirmation: "password")) + players_for_league.push(User.create(name: "Derpanator115", password: "password", email: "Derpanator115@gmail.com", user_name: "Derpanator115", password_confirmation: "password")) + players_for_league.push(User.create(name: "Wlknexe56", password: "password", email: "Wlknexe56@gmail.com", user_name: "Wlknexe56", password_confirmation: "password")) + players_for_league.push(User.create(name: "DVisionzz", password: "password", email: "DVisionzz@gmail.com", user_name: "DVisionzz", password_confirmation: "password")) + players_for_league.push(User.create(name: "HYP3RTONIC", password: "password", email: "HYP3RTONIC@gmail.com", user_name: "HYP3RTONIC", password_confirmation: "password")) + players_for_league.push(User.create(name: "M9Fumjaa", password: "password", email: "M9Fumjaa@gmail.com", user_name: "M9Fumjaa", password_confirmation: "password")) + players_for_league.push(User.create(name: "spikevsnaruto", password: "password", email: "spikevsnaruto@gmail.com", user_name: "spikevsnaruto", password_confirmation: "password")) + players_for_league.push(User.create(name: "GoogleMaSkills", password: "password", email: "GoogleMaSkills@gmail.com", user_name: "GoogleMaSkills", password_confirmation: "password")) + players_for_league.push(User.create(name: "james chamberlan", password: "password", email: "jameschamberlan@gmail.com", user_name: "james chamberlan", password_confirmation: "password")) + players_for_league.push(User.create(name: "Kaceytron", password: "password", email: "Kaceytron@gmail.com", user_name: "Kaceytron", password_confirmation: "password")) + + #semi-real users + User.create(name: "Davis Webb", password: "password", email: "davislwebb@gmail.com", user_name: "TeslasMind", password_confirmation: "password") + User.create(name: "Nathaniel Foy", password: "password", email: "nfoy@notreal.com", user_name: "Nalfeinx", password_confirmation: "password") + User.create(name: "Guntas Grewal", password: "password", email: "guntasgrewal@gmail.com", user_name: "guntasgrewal", password_confirmation: "password") + User.create(name: "Luke Shumaker", password: "password", email: "lukeshu@emacs4lyfe.com", user_name: "lukeshu", password_confirmation: "password") + User.create(name: "Tomer Kimia", password: "password", email: "tomer@2majors4lyfe.com", user_name: "tkimia", password_confirmation: "password") + User.create(name: "Andrew Murrell", password: "password", email: "murrel@murrel.gov", user_name: "ImFromNasa", password_confirmation: "password") + User.create(name: "Joseph Adams", password: "password", email: "alpha142@fluttershyop.com", user_name: "alpha142", password_confirmation: "password") + User.create(name: "Josh Huser", password: "password", email: "jhuser@iownabusiness.net", user_name: "WinterWorks", password_confirmation: "password") + User.create(name: "Professor Dunsmore", password: "password", email: "bxd@purdue.edu", user_name: "Dumbledore", password_confirmation: "password") + User.create(name: "Marco Polo", password: "password", email: "marco@ta4lyfe.com", user_name: "iCoordinate", password_confirmation: "password") + User.create(name: "Geoffrey Webb", password: "password", email: "imnotjoffreybarathian@gameofthrones.com", user_name: "GTBPhoenix", password_confirmation: "password") + User.create(name: "Obama", password: "password", email: "obama@whitehouse.gov", user_name: "Obama", password_confirmation: "password") + + + #league of legends tournament + league_tourn = Tournament.create(game_id: 1, status: 0, name: "League of Legends Seed", min_players_per_team: 5, max_players_per_team: 5, min_teams_per_match: 2, + max_teams_per_match: 2, set_rounds: 1, randomized_teams: true, sampling_method: nil) + + for i in 0..9 + if i == 0 + league_tourn.hosts.push(players_for_league[i]) + end + league_tourn.join(players_for_league[i]) + end + league_tourn.join(players_for_league[9]) + + #chess + Tournament.create(game_id: 2, status: 0, name: "Chess Seed", min_players_per_team: 1, max_players_per_team: 1, min_teams_per_match: 2, + max_teams_per_match: 2, set_rounds: 1, randomized_teams: true, sampling_method: nil) + + #Rock Paper Scissors + Tournament.create(game_id: 4, status: 0, name: "Rock, Paper, Scissors Seed", min_players_per_team: 1, max_players_per_team: 3, min_teams_per_match: 2, + max_teams_per_match: 2, set_rounds: 1, randomized_teams: true, sampling_method: nil) end -- cgit v1.1-4-g5e80 From bd1bfe729030312fc678a3705c881744aa650c63 Mon Sep 17 00:00:00 2001 From: tkimia Date: Thu, 24 Apr 2014 18:08:26 -0400 Subject: text in graph is a bit better --- app/assets/stylesheets/matches.css.scss | 15 +++++++++++++++ lib/scheduling/elimination.rb | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/app/assets/stylesheets/matches.css.scss b/app/assets/stylesheets/matches.css.scss index 66da68e..ee43ab4 100644 --- a/app/assets/stylesheets/matches.css.scss +++ b/app/assets/stylesheets/matches.css.scss @@ -51,4 +51,19 @@ form { color: #333; } +} + +svg { + min-width: 600px; +} + +@media (max-width: 900px) { + svg text { + font-size: 200%; + } +} +@media (max-width: 700px) { + svg text { + font-size: 150%; + } } \ No newline at end of file diff --git a/lib/scheduling/elimination.rb b/lib/scheduling/elimination.rb index e66a29a..4e368b5 100644 --- a/lib/scheduling/elimination.rb +++ b/lib/scheduling/elimination.rb @@ -108,7 +108,7 @@ STRING t = 1 while t <= numTeams - color = (matches[i].teams[t-1] and matches[i].teams[t-1].users.include?(current_user)) ? "#BCED91" : "white" + color = (matches[i].teams[t-1] and matches[i].teams[t-1].users.include?(current_user)) ? "#5BC0DE" : "white" str += "\t\t\n" if matches[i].teams[t-1] str += "\t\tTeam #{matches[i].teams[t-1].id}\n" -- cgit v1.1-4-g5e80 From 575c8a552cbcf11934b32f4d24636cdc18094f53 Mon Sep 17 00:00:00 2001 From: tkimia Date: Thu, 24 Apr 2014 18:37:18 -0400 Subject: number of matches has new formula that works for all teams/match --- lib/scheduling/elimination.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/scheduling/elimination.rb b/lib/scheduling/elimination.rb index 4e368b5..cf0d625 100644 --- a/lib/scheduling/elimination.rb +++ b/lib/scheduling/elimination.rb @@ -17,7 +17,7 @@ module Scheduling def create_matches num_teams = (self.tournament.players.count/self.tournament.min_players_per_team).floor - num_matches = num_teams - 1 + num_matches = (Float(num_teams - tournament.min_teams_per_match)/(tournament.min_teams_per_match - 1)).ceil + 1 for i in 1..num_matches self.tournament_stage.matches.create(status: 0, submitted_peer_evaluations: 0) end -- cgit v1.1-4-g5e80 From c38a00c8fbc549d1ec45834ee05b19a38d2dd246 Mon Sep 17 00:00:00 2001 From: guntasgrewal Date: Thu, 24 Apr 2014 18:41:53 -0400 Subject: TOMER WE ADDED YOUR DESIRED 5 TEAM SEED --- app/controllers/matches_controller.rb | 4 +-- db/seeds.rb | 50 +++++++++++++++++++++++++---------- 2 files changed, 38 insertions(+), 16 deletions(-) diff --git a/app/controllers/matches_controller.rb b/app/controllers/matches_controller.rb index 1ad86d0..138cf28 100644 --- a/app/controllers/matches_controller.rb +++ b/app/controllers/matches_controller.rb @@ -23,8 +23,8 @@ class MatchesController < ApplicationController @match.teams.each do |team| team.users.each do |user| - players_id.push(user.remote_usernames[0]["json_value"]["id"]) - players.push(user.remote_usernames[0]["json_value"]["id"]) + players_id.push(user.remote_usernames[0].value["id"]) + players.push(user.remote_usernames[0].value["name"]) end end diff --git a/db/seeds.rb b/db/seeds.rb index 7f066bc..61cf44a 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -68,24 +68,25 @@ if Rails.env.development? players_for_league.push(User.create(name: "Kaceytron", password: "password", email: "Kaceytron@gmail.com", user_name: "Kaceytron", password_confirmation: "password")) #semi-real users - User.create(name: "Davis Webb", password: "password", email: "davislwebb@gmail.com", user_name: "TeslasMind", password_confirmation: "password") - User.create(name: "Nathaniel Foy", password: "password", email: "nfoy@notreal.com", user_name: "Nalfeinx", password_confirmation: "password") - User.create(name: "Guntas Grewal", password: "password", email: "guntasgrewal@gmail.com", user_name: "guntasgrewal", password_confirmation: "password") - User.create(name: "Luke Shumaker", password: "password", email: "lukeshu@emacs4lyfe.com", user_name: "lukeshu", password_confirmation: "password") - User.create(name: "Tomer Kimia", password: "password", email: "tomer@2majors4lyfe.com", user_name: "tkimia", password_confirmation: "password") - User.create(name: "Andrew Murrell", password: "password", email: "murrel@murrel.gov", user_name: "ImFromNasa", password_confirmation: "password") - User.create(name: "Joseph Adams", password: "password", email: "alpha142@fluttershyop.com", user_name: "alpha142", password_confirmation: "password") - User.create(name: "Josh Huser", password: "password", email: "jhuser@iownabusiness.net", user_name: "WinterWorks", password_confirmation: "password") - User.create(name: "Professor Dunsmore", password: "password", email: "bxd@purdue.edu", user_name: "Dumbledore", password_confirmation: "password") - User.create(name: "Marco Polo", password: "password", email: "marco@ta4lyfe.com", user_name: "iCoordinate", password_confirmation: "password") - User.create(name: "Geoffrey Webb", password: "password", email: "imnotjoffreybarathian@gameofthrones.com", user_name: "GTBPhoenix", password_confirmation: "password") - User.create(name: "Obama", password: "password", email: "obama@whitehouse.gov", user_name: "Obama", password_confirmation: "password") + davis = User.create(name: "Davis Webb", password: "password", email: "davislwebb@gmail.com", user_name: "TeslasMind", password_confirmation: "password") + foy = User.create(name: "Nathaniel Foy", password: "password", email: "nfoy@notreal.com", user_name: "Nalfeinx", password_confirmation: "password") + guntas = User.create(name: "Guntas Grewal", password: "password", email: "guntasgrewal@gmail.com", user_name: "guntasgrewal", password_confirmation: "password") + luke = User.create(name: "Luke Shumaker", password: "password", email: "lukeshu@emacs4lyfe.com", user_name: "lukeshu", password_confirmation: "password") + tomer = User.create(name: "Tomer Kimia", password: "password", email: "tomer@2majors4lyfe.com", user_name: "tkimia", password_confirmation: "password") + andrew = User.create(name: "Andrew Murrell", password: "password", email: "murrel@murrel.gov", user_name: "ImFromNasa", password_confirmation: "password") + joey = User.create(name: "Joseph Adams", password: "password", email: "alpha142@fluttershyop.com", user_name: "alpha142", password_confirmation: "password") + josh = User.create(name: "Josh Huser", password: "password", email: "jhuser@iownabusiness.net", user_name: "WinterWorks", password_confirmation: "password") + dunsmore = User.create(name: "Professor Dunsmore", password: "password", email: "bxd@purdue.edu", user_name: "Dumbledore", password_confirmation: "password") + marco = User.create(name: "Marco Polo", password: "password", email: "marco@ta4lyfe.com", user_name: "iCoordinate", password_confirmation: "password") + jordan = User.create(name: "Geoffrey Webb", password: "password", email: "imnotjoffreybarathian@gameofthrones.com", user_name: "GTBPhoenix", password_confirmation: "password") + obama = User.create(name: "Obama", password: "password", email: "obama@whitehouse.gov", user_name: "Obama", password_confirmation: "password") #league of legends tournament league_tourn = Tournament.create(game_id: 1, status: 0, name: "League of Legends Seed", min_players_per_team: 5, max_players_per_team: 5, min_teams_per_match: 2, max_teams_per_match: 2, set_rounds: 1, randomized_teams: true, sampling_method: nil) + #adds players to the seeded league tournament for i in 0..9 if i == 0 league_tourn.hosts.push(players_for_league[i]) @@ -95,10 +96,31 @@ if Rails.env.development? league_tourn.join(players_for_league[9]) #chess - Tournament.create(game_id: 2, status: 0, name: "Chess Seed", min_players_per_team: 1, max_players_per_team: 1, min_teams_per_match: 2, + chess_tourn = Tournament.create(game_id: 2, status: 0, name: "Chess Seed", min_players_per_team: 1, max_players_per_team: 1, min_teams_per_match: 2, max_teams_per_match: 2, set_rounds: 1, randomized_teams: true, sampling_method: nil) + chess_tourn.hosts.push(davis) + chess_tourn.join(davis) + chess_tourn.join(foy) + #Rock Paper Scissors - Tournament.create(game_id: 4, status: 0, name: "Rock, Paper, Scissors Seed", min_players_per_team: 1, max_players_per_team: 3, min_teams_per_match: 2, + rps = Tournament.create(game_id: 4, status: 0, name: "Rock, Paper, Scissors Seed", min_players_per_team: 1, max_players_per_team: 3, min_teams_per_match: 2, max_teams_per_match: 2, set_rounds: 1, randomized_teams: true, sampling_method: nil) + + rps.hosts.push(davis) + rps.join(davis) + rps.join(foy) + rps.join(guntas) + + tourn5 = Tournament.create(game_id: 1, status: 0, name: "5 Teams, 2 Teams Per Match", min_players_per_team: 1, max_players_per_team: 1, min_teams_per_match: 2, + max_teams_per_match: 2, set_rounds: 1, randomized_teams: true, sampling_method: nil) + + for i in 0..9 + if i == 0 + tourn5.hosts.push(players_for_league[i]) + end + tourn5.join(players_for_league[i]) + end + tourn5.join(players_for_league[9]) + end -- cgit v1.1-4-g5e80 From db073045ff7cf5d8a2fb4a3349ed6a9a6ac019d3 Mon Sep 17 00:00:00 2001 From: guntasgrewal Date: Thu, 24 Apr 2014 18:59:43 -0400 Subject: the db script --- db.sh | 2 ++ 1 file changed, 2 insertions(+) create mode 100755 db.sh diff --git a/db.sh b/db.sh new file mode 100755 index 0000000..9d86834 --- /dev/null +++ b/db.sh @@ -0,0 +1,2 @@ +#!/bin/bash +bundle exec rake db:drop && bundle exec rake db:migrate && bundle exec rake db:seed -- cgit v1.1-4-g5e80