From 5a7f5f6bc00d2abe2d5cd71363d4d5116bf4de51 Mon Sep 17 00:00:00 2001 From: AndrewMurrell Date: Mon, 28 Apr 2014 18:27:52 -0400 Subject: Make Statistic#value a rich (JSON) object --- app/models/statistic.rb | 23 +++++++++++++++++++++++ generate.sh | 2 +- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/app/models/statistic.rb b/app/models/statistic.rb index 341fd9d..b4608b8 100644 --- a/app/models/statistic.rb +++ b/app/models/statistic.rb @@ -1,4 +1,27 @@ class Statistic < ActiveRecord::Base belongs_to :user belongs_to :match + + def value + begin + return JSON.parse(self.json_value) + rescue + return {} + end + end + + def value=(v) + self.json_value = v.to_json + end + + after_save :update_match + def update_match + if (self.name == "win") and (self.value > 0) + self.match.winner = self.match.teams.find{|t| t.users.include? self.user} + end + if (self.match.status == 2) and (self.match.finished?) + self.match.status = 3 + end + self.match.save + end end diff --git a/generate.sh b/generate.sh index 6a6c502..ffcde4b 100755 --- a/generate.sh +++ b/generate.sh @@ -55,7 +55,7 @@ bundle exec rails generate model game_setting game:references name:s bundle exec rails generate model tournament_setting tournament:references name:string vartype:integer type_opt:text description:text display_order:integer value:text bundle exec rails generate model tournament_stage tournament:references structure:text scheduling_method:string seeding_method:string -bundle exec rails generate model statistic user:references match:references name:string value:integer +bundle exec rails generate model statistic user:references match:references name:string json_value:text bundle exec rails generate model remote_username game:references user:references json_value:text -- cgit v1.2.3 From cd19b2591a52ac604632a70929448ee5e78c2568 Mon Sep 17 00:00:00 2001 From: AndrewMurrell Date: Mon, 28 Apr 2014 18:29:01 -0400 Subject: Misc fixes. (This commit is from Luke on Andrew's box) --- app/controllers/matches_controller.rb | 16 ++++------------ app/models/match.rb | 7 ++----- lib/sampling/manual.rb | 4 ++-- lib/sampling/peer_review.rb | 8 ++++---- lib/scoring/winner_takes_all.rb | 4 ++-- 5 files changed, 14 insertions(+), 25 deletions(-) diff --git a/app/controllers/matches_controller.rb b/app/controllers/matches_controller.rb index bed06ba..5745ac9 100644 --- a/app/controllers/matches_controller.rb +++ b/app/controllers/matches_controller.rb @@ -45,18 +45,10 @@ class MatchesController < ApplicationController when 2 # Started, waiting to finish @match.handle_sampling(params) - if @match.finished? - @match.status = 3 - respond_to do |format| - if @match.save - format.html { redirect_to tournament_match_path(@tournament, @match), notice: 'Match has finished.' } - format.json { head :no_content } - else - format.html { render action: 'show' } - format.json { render json: @match.errors, status: :unprocessable_entity } - end - end - return + # The @match.status will be updated by Statistic's after_save hook + respond_to do |format| + format.html { redirect_to tournament_match_path(@tournament, @match), notice: 'Match has finished.' } + format.json { head :no_content } end when 3 if (@tournament.hosts.include? current_user) and (params[:update_action] == "start") diff --git a/app/models/match.rb b/app/models/match.rb index 4c7acbf..219e662 100644 --- a/app/models/match.rb +++ b/app/models/match.rb @@ -5,9 +5,6 @@ class Match < ActiveRecord::Base belongs_to :winner, class_name: "Team" - def setup() - end - def finished? ok = true tournament_stage.scoring_method.stats_needed.each do |stat| @@ -59,7 +56,7 @@ class Match < ActiveRecord::Base method_class = "Sampling::#{method_name.camelcase}".constantize needed.each do |stat| data[stat] ||= {} - data[stat][method] = method_class.can_get?(user, stat) + data[stat][method_class] = method_class.can_get?(stat) end end @@ -83,7 +80,7 @@ class Match < ActiveRecord::Base if @method_classes.nil? data = Set.new figure_sampling_methods.each do |stat,method| - data.push(method) + data.add(method) end @method_classes = data end diff --git a/lib/sampling/manual.rb b/lib/sampling/manual.rb index a190bd2..cfecd8f 100644 --- a/lib/sampling/manual.rb +++ b/lib/sampling/manual.rb @@ -4,7 +4,7 @@ module Sampling return true end - def can_get?(setting_name) + def self.can_get?(setting_name) return 1 end @@ -36,7 +36,7 @@ module Sampling @stats = @match.stats_from(self.class) require 'erb' - erb_filename = File.join(__FILE__.sub(/\.rb$/, '.svg.erb')) + erb_filename = File.join(__FILE__.sub(/\.rb$/, '.html.erb')) erb = ERB.new(File.read(erb_filename)) erb.filename = erb_filename return erb.result.html_safe diff --git a/lib/sampling/peer_review.rb b/lib/sampling/peer_review.rb index 4577542..e86595f 100644 --- a/lib/sampling/peer_review.rb +++ b/lib/sampling/peer_review.rb @@ -5,7 +5,7 @@ module Sampling end def self.can_get?(setting_name) - return setting_name.start_with?("feedback_from_") + return setting_name.start_with?("feedback_from_") ? 2 : 0 end def self.uses_remote? @@ -36,7 +36,7 @@ module Sampling @feedbacks_missing = get_feedbacks_missing(match) require 'erb' - erb_filename = File.join(__FILE__.sub(/\.rb$/, '.svg.erb')) + erb_filename = File.join(__FILE__.sub(/\.rb$/, '.html.erb')) erb = ERB.new(File.read(erb_filename)) erb.filename = erb_filename return erb.result.html_safe @@ -74,14 +74,14 @@ module Sampling def self.get_feedbacks_missing(match) require 'set' - ret = Set.new() + ret = Set.new feedback = get_feedbacks(match) users = get_users(match) feedback.each do |feedback| (users - feedback.keys).each do |user| - ret.push(user) + ret.add(user) end end diff --git a/lib/scoring/winner_takes_all.rb b/lib/scoring/winner_takes_all.rb index bf95781..57ddae6 100644 --- a/lib/scoring/winner_takes_all.rb +++ b/lib/scoring/winner_takes_all.rb @@ -1,13 +1,13 @@ module Scoring module WinnerTakesAll def self.stats_needed - return [] + return ["win"] end def self.score(match, interface) scores = {} match.players.each do |player| - scores[player.user_name] = score_user(match.win?(player)) + scores[player.user_name] = score_user(player.statistics.where(:match => match, :name => "win").value) end scores end -- cgit v1.2.3 From b45ed282cb9b677d2973d7d25839f4cc60d738bd Mon Sep 17 00:00:00 2001 From: AndrewMurrell Date: Mon, 28 Apr 2014 18:36:30 -0400 Subject: Fixing Manual --- lib/sampling/manual.html.erb | 13 ++++++++++++- lib/sampling/manual.rb | 1 + 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/lib/sampling/manual.html.erb b/lib/sampling/manual.html.erb index cf873b4..c9dd2fe 100644 --- a/lib/sampling/manual.html.erb +++ b/lib/sampling/manual.html.erb @@ -1 +1,12 @@ - +<% if @tournament.hosts.include? current_user %> + + <% @match.teams.each do |team| %> + <%= tag :input, {"type" => "radio", "name" => "winner", "value" => "#{team.id}" } %> + <%= "Team #{team.id} Won" %> + <% end %> + + <%= submit_tag("Finish match") %> + <%= @tournament.settings['ScoringMethod'] %> +<% else %> +

The match is running; the host has yet to post the scores of the match.

+<% end %> \ No newline at end of file diff --git a/lib/sampling/manual.rb b/lib/sampling/manual.rb index cfecd8f..1787cb7 100644 --- a/lib/sampling/manual.rb +++ b/lib/sampling/manual.rb @@ -31,6 +31,7 @@ module Sampling end def render_user_interaction(user) + @tournament = @match.tournament_stage.tournament @current_user = user @users = @match.users @stats = @match.stats_from(self.class) -- cgit v1.2.3 From 2da30b70123a245c0515d65ea7cc59ddf68a3011 Mon Sep 17 00:00:00 2001 From: AndrewMurrell Date: Mon, 28 Apr 2014 18:37:43 -0400 Subject: Master's Generate --- generate.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generate.sh b/generate.sh index 6a6c502..ffcde4b 100755 --- a/generate.sh +++ b/generate.sh @@ -55,7 +55,7 @@ bundle exec rails generate model game_setting game:references name:s bundle exec rails generate model tournament_setting tournament:references name:string vartype:integer type_opt:text description:text display_order:integer value:text bundle exec rails generate model tournament_stage tournament:references structure:text scheduling_method:string seeding_method:string -bundle exec rails generate model statistic user:references match:references name:string value:integer +bundle exec rails generate model statistic user:references match:references name:string json_value:text bundle exec rails generate model remote_username game:references user:references json_value:text -- cgit v1.2.3 From 6ff352e4b565895b2b865e2d1fb49e1de2e8c131 Mon Sep 17 00:00:00 2001 From: AndrewMurrell Date: Mon, 28 Apr 2014 18:44:42 -0400 Subject: ran the generate thingy --- .../20140428092839_create_simple_captcha_data.rb | 15 ------ ...0428132832_create_mailboxer.mailboxer_engine.rb | 62 ---------------------- ...8132833_add_notified_object.mailboxer_engine.rb | 18 ------- ...32834_add_notification_code.mailboxer_engine.rb | 14 ----- ...40428132835_add_attachments.mailboxer_engine.rb | 10 ---- ...132836_rename_receipts_read.mailboxer_engine.rb | 10 ---- ...global_notification_support.mailboxer_engine.rb | 10 ---- db/migrate/20140428132845_create_delayed_jobs.rb | 22 -------- db/migrate/20140428132852_create_servers.rb | 9 ---- db/migrate/20140428132900_create_matches.rb | 13 ----- db/migrate/20140428132907_create_teams.rb | 8 --- db/migrate/20140428132914_create_alerts.rb | 10 ---- db/migrate/20140428132922_create_pms.rb | 13 ----- db/migrate/20140428132929_create_tournaments.rb | 17 ------ db/migrate/20140428132937_create_games.rb | 16 ------ db/migrate/20140428132944_create_users.rb | 13 ----- db/migrate/20140428132951_create_sessions.rb | 11 ---- db/migrate/20140428132958_create_brackets.rb | 11 ---- db/migrate/20140428133006_create_game_settings.rb | 15 ------ .../20140428133013_create_tournament_settings.rb | 15 ------ .../20140428133020_create_tournament_stages.rb | 12 ----- db/migrate/20140428133026_create_statistics.rb | 12 ----- .../20140428133033_create_remote_usernames.rb | 11 ---- .../20140428133041_create_bracket_matches.rb | 11 ---- db/migrate/20140428133048_create_api_requests.rb | 9 ---- ...8133055_create_tournament_players_join_table.rb | 8 --- ...428133102_create_tournament_hosts_join_table.rb | 8 --- .../20140428133109_create_team_user_join_table.rb | 8 --- .../20140428133116_create_match_team_join_table.rb | 8 --- .../20140428133136_add_hidden_attrs_to_user.rb | 6 --- .../20140428183808_create_simple_captcha_data.rb | 15 ++++++ ...0428223805_create_mailboxer.mailboxer_engine.rb | 62 ++++++++++++++++++++++ ...8223806_add_notified_object.mailboxer_engine.rb | 18 +++++++ ...23807_add_notification_code.mailboxer_engine.rb | 14 +++++ ...40428223808_add_attachments.mailboxer_engine.rb | 10 ++++ ...223809_rename_receipts_read.mailboxer_engine.rb | 10 ++++ ...global_notification_support.mailboxer_engine.rb | 10 ++++ db/migrate/20140428223812_create_delayed_jobs.rb | 22 ++++++++ db/migrate/20140428223815_create_servers.rb | 9 ++++ db/migrate/20140428223819_create_matches.rb | 13 +++++ db/migrate/20140428223823_create_teams.rb | 8 +++ db/migrate/20140428223827_create_alerts.rb | 10 ++++ db/migrate/20140428223830_create_pms.rb | 13 +++++ db/migrate/20140428223834_create_tournaments.rb | 17 ++++++ db/migrate/20140428223838_create_games.rb | 16 ++++++ db/migrate/20140428223842_create_users.rb | 13 +++++ db/migrate/20140428223845_create_sessions.rb | 11 ++++ db/migrate/20140428223849_create_brackets.rb | 11 ++++ db/migrate/20140428223853_create_game_settings.rb | 15 ++++++ .../20140428223856_create_tournament_settings.rb | 15 ++++++ .../20140428223900_create_tournament_stages.rb | 12 +++++ db/migrate/20140428223903_create_statistics.rb | 12 +++++ .../20140428223907_create_remote_usernames.rb | 11 ++++ .../20140428223911_create_bracket_matches.rb | 11 ++++ db/migrate/20140428223914_create_api_requests.rb | 9 ++++ ...8223918_create_tournament_players_join_table.rb | 8 +++ ...428223922_create_tournament_hosts_join_table.rb | 8 +++ .../20140428223925_create_team_user_join_table.rb | 8 +++ .../20140428223929_create_match_team_join_table.rb | 8 +++ .../20140428223939_add_hidden_attrs_to_user.rb | 6 +++ db/schema.rb | 4 +- test/fixtures/statistics.yml | 4 +- 62 files changed, 409 insertions(+), 409 deletions(-) delete mode 100644 db/migrate/20140428092839_create_simple_captcha_data.rb delete mode 100644 db/migrate/20140428132832_create_mailboxer.mailboxer_engine.rb delete mode 100644 db/migrate/20140428132833_add_notified_object.mailboxer_engine.rb delete mode 100644 db/migrate/20140428132834_add_notification_code.mailboxer_engine.rb delete mode 100644 db/migrate/20140428132835_add_attachments.mailboxer_engine.rb delete mode 100644 db/migrate/20140428132836_rename_receipts_read.mailboxer_engine.rb delete mode 100644 db/migrate/20140428132837_add_global_notification_support.mailboxer_engine.rb delete mode 100644 db/migrate/20140428132845_create_delayed_jobs.rb delete mode 100644 db/migrate/20140428132852_create_servers.rb delete mode 100644 db/migrate/20140428132900_create_matches.rb delete mode 100644 db/migrate/20140428132907_create_teams.rb delete mode 100644 db/migrate/20140428132914_create_alerts.rb delete mode 100644 db/migrate/20140428132922_create_pms.rb delete mode 100644 db/migrate/20140428132929_create_tournaments.rb delete mode 100644 db/migrate/20140428132937_create_games.rb delete mode 100644 db/migrate/20140428132944_create_users.rb delete mode 100644 db/migrate/20140428132951_create_sessions.rb delete mode 100644 db/migrate/20140428132958_create_brackets.rb delete mode 100644 db/migrate/20140428133006_create_game_settings.rb delete mode 100644 db/migrate/20140428133013_create_tournament_settings.rb delete mode 100644 db/migrate/20140428133020_create_tournament_stages.rb delete mode 100644 db/migrate/20140428133026_create_statistics.rb delete mode 100644 db/migrate/20140428133033_create_remote_usernames.rb delete mode 100644 db/migrate/20140428133041_create_bracket_matches.rb delete mode 100644 db/migrate/20140428133048_create_api_requests.rb delete mode 100644 db/migrate/20140428133055_create_tournament_players_join_table.rb delete mode 100644 db/migrate/20140428133102_create_tournament_hosts_join_table.rb delete mode 100644 db/migrate/20140428133109_create_team_user_join_table.rb delete mode 100644 db/migrate/20140428133116_create_match_team_join_table.rb delete mode 100644 db/migrate/20140428133136_add_hidden_attrs_to_user.rb create mode 100644 db/migrate/20140428183808_create_simple_captcha_data.rb create mode 100644 db/migrate/20140428223805_create_mailboxer.mailboxer_engine.rb create mode 100644 db/migrate/20140428223806_add_notified_object.mailboxer_engine.rb create mode 100644 db/migrate/20140428223807_add_notification_code.mailboxer_engine.rb create mode 100644 db/migrate/20140428223808_add_attachments.mailboxer_engine.rb create mode 100644 db/migrate/20140428223809_rename_receipts_read.mailboxer_engine.rb create mode 100644 db/migrate/20140428223810_add_global_notification_support.mailboxer_engine.rb create mode 100644 db/migrate/20140428223812_create_delayed_jobs.rb create mode 100644 db/migrate/20140428223815_create_servers.rb create mode 100644 db/migrate/20140428223819_create_matches.rb create mode 100644 db/migrate/20140428223823_create_teams.rb create mode 100644 db/migrate/20140428223827_create_alerts.rb create mode 100644 db/migrate/20140428223830_create_pms.rb create mode 100644 db/migrate/20140428223834_create_tournaments.rb create mode 100644 db/migrate/20140428223838_create_games.rb create mode 100644 db/migrate/20140428223842_create_users.rb create mode 100644 db/migrate/20140428223845_create_sessions.rb create mode 100644 db/migrate/20140428223849_create_brackets.rb create mode 100644 db/migrate/20140428223853_create_game_settings.rb create mode 100644 db/migrate/20140428223856_create_tournament_settings.rb create mode 100644 db/migrate/20140428223900_create_tournament_stages.rb create mode 100644 db/migrate/20140428223903_create_statistics.rb create mode 100644 db/migrate/20140428223907_create_remote_usernames.rb create mode 100644 db/migrate/20140428223911_create_bracket_matches.rb create mode 100644 db/migrate/20140428223914_create_api_requests.rb create mode 100644 db/migrate/20140428223918_create_tournament_players_join_table.rb create mode 100644 db/migrate/20140428223922_create_tournament_hosts_join_table.rb create mode 100644 db/migrate/20140428223925_create_team_user_join_table.rb create mode 100644 db/migrate/20140428223929_create_match_team_join_table.rb create mode 100644 db/migrate/20140428223939_add_hidden_attrs_to_user.rb diff --git a/db/migrate/20140428092839_create_simple_captcha_data.rb b/db/migrate/20140428092839_create_simple_captcha_data.rb deleted file mode 100644 index 4573b20..0000000 --- a/db/migrate/20140428092839_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/20140428132832_create_mailboxer.mailboxer_engine.rb b/db/migrate/20140428132832_create_mailboxer.mailboxer_engine.rb deleted file mode 100644 index 690cec2..0000000 --- a/db/migrate/20140428132832_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/20140428132833_add_notified_object.mailboxer_engine.rb b/db/migrate/20140428132833_add_notified_object.mailboxer_engine.rb deleted file mode 100644 index 7f41ac6..0000000 --- a/db/migrate/20140428132833_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/20140428132834_add_notification_code.mailboxer_engine.rb b/db/migrate/20140428132834_add_notification_code.mailboxer_engine.rb deleted file mode 100644 index 04c12ef..0000000 --- a/db/migrate/20140428132834_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/20140428132835_add_attachments.mailboxer_engine.rb b/db/migrate/20140428132835_add_attachments.mailboxer_engine.rb deleted file mode 100644 index b8d6588..0000000 --- a/db/migrate/20140428132835_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/20140428132836_rename_receipts_read.mailboxer_engine.rb b/db/migrate/20140428132836_rename_receipts_read.mailboxer_engine.rb deleted file mode 100644 index 9ce904f..0000000 --- a/db/migrate/20140428132836_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/20140428132837_add_global_notification_support.mailboxer_engine.rb b/db/migrate/20140428132837_add_global_notification_support.mailboxer_engine.rb deleted file mode 100644 index 60f67ab..0000000 --- a/db/migrate/20140428132837_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/20140428132845_create_delayed_jobs.rb b/db/migrate/20140428132845_create_delayed_jobs.rb deleted file mode 100644 index ec0dd93..0000000 --- a/db/migrate/20140428132845_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/20140428132852_create_servers.rb b/db/migrate/20140428132852_create_servers.rb deleted file mode 100644 index fbe1b02..0000000 --- a/db/migrate/20140428132852_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/20140428132900_create_matches.rb b/db/migrate/20140428132900_create_matches.rb deleted file mode 100644 index bac92d1..0000000 --- a/db/migrate/20140428132900_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/20140428132907_create_teams.rb b/db/migrate/20140428132907_create_teams.rb deleted file mode 100644 index dd8397d..0000000 --- a/db/migrate/20140428132907_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/20140428132914_create_alerts.rb b/db/migrate/20140428132914_create_alerts.rb deleted file mode 100644 index 68a8e10..0000000 --- a/db/migrate/20140428132914_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/20140428132922_create_pms.rb b/db/migrate/20140428132922_create_pms.rb deleted file mode 100644 index eb9f443..0000000 --- a/db/migrate/20140428132922_create_pms.rb +++ /dev/null @@ -1,13 +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.text :subject - t.references :conversation, index: true - - t.timestamps - end - end -end diff --git a/db/migrate/20140428132929_create_tournaments.rb b/db/migrate/20140428132929_create_tournaments.rb deleted file mode 100644 index f3715bb..0000000 --- a/db/migrate/20140428132929_create_tournaments.rb +++ /dev/null @@ -1,17 +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.string :scoring_method - - t.timestamps - end - add_index :tournaments, :name, unique: true - end -end diff --git a/db/migrate/20140428132937_create_games.rb b/db/migrate/20140428132937_create_games.rb deleted file mode 100644 index e841667..0000000 --- a/db/migrate/20140428132937_create_games.rb +++ /dev/null @@ -1,16 +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.string :scoring_method - - t.timestamps - end - add_index :games, :name, unique: true - end -end diff --git a/db/migrate/20140428132944_create_users.rb b/db/migrate/20140428132944_create_users.rb deleted file mode 100644 index 8032870..0000000 --- a/db/migrate/20140428132944_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/20140428132951_create_sessions.rb b/db/migrate/20140428132951_create_sessions.rb deleted file mode 100644 index f667f1e..0000000 --- a/db/migrate/20140428132951_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/20140428132958_create_brackets.rb b/db/migrate/20140428132958_create_brackets.rb deleted file mode 100644 index 8813bf2..0000000 --- a/db/migrate/20140428132958_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/20140428133006_create_game_settings.rb b/db/migrate/20140428133006_create_game_settings.rb deleted file mode 100644 index 06fb72e..0000000 --- a/db/migrate/20140428133006_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/20140428133013_create_tournament_settings.rb b/db/migrate/20140428133013_create_tournament_settings.rb deleted file mode 100644 index e56697f..0000000 --- a/db/migrate/20140428133013_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/20140428133020_create_tournament_stages.rb b/db/migrate/20140428133020_create_tournament_stages.rb deleted file mode 100644 index 6e52bf0..0000000 --- a/db/migrate/20140428133020_create_tournament_stages.rb +++ /dev/null @@ -1,12 +0,0 @@ -class CreateTournamentStages < ActiveRecord::Migration - def change - create_table :tournament_stages do |t| - t.references :tournament, index: true - t.text :structure - t.string :scheduling_method - t.string :seeding_method - - t.timestamps - end - end -end diff --git a/db/migrate/20140428133026_create_statistics.rb b/db/migrate/20140428133026_create_statistics.rb deleted file mode 100644 index cc2e97d..0000000 --- a/db/migrate/20140428133026_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/20140428133033_create_remote_usernames.rb b/db/migrate/20140428133033_create_remote_usernames.rb deleted file mode 100644 index e265985..0000000 --- a/db/migrate/20140428133033_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/20140428133041_create_bracket_matches.rb b/db/migrate/20140428133041_create_bracket_matches.rb deleted file mode 100644 index 3323e31..0000000 --- a/db/migrate/20140428133041_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/20140428133048_create_api_requests.rb b/db/migrate/20140428133048_create_api_requests.rb deleted file mode 100644 index 544c330..0000000 --- a/db/migrate/20140428133048_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/20140428133055_create_tournament_players_join_table.rb b/db/migrate/20140428133055_create_tournament_players_join_table.rb deleted file mode 100644 index be240e8..0000000 --- a/db/migrate/20140428133055_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/20140428133102_create_tournament_hosts_join_table.rb b/db/migrate/20140428133102_create_tournament_hosts_join_table.rb deleted file mode 100644 index 7521d89..0000000 --- a/db/migrate/20140428133102_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/20140428133109_create_team_user_join_table.rb b/db/migrate/20140428133109_create_team_user_join_table.rb deleted file mode 100644 index f3b57fc..0000000 --- a/db/migrate/20140428133109_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/20140428133116_create_match_team_join_table.rb b/db/migrate/20140428133116_create_match_team_join_table.rb deleted file mode 100644 index c2ed1b7..0000000 --- a/db/migrate/20140428133116_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/20140428133136_add_hidden_attrs_to_user.rb b/db/migrate/20140428133136_add_hidden_attrs_to_user.rb deleted file mode 100644 index 9b5c505..0000000 --- a/db/migrate/20140428133136_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/20140428183808_create_simple_captcha_data.rb b/db/migrate/20140428183808_create_simple_captcha_data.rb new file mode 100644 index 0000000..4573b20 --- /dev/null +++ b/db/migrate/20140428183808_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/20140428223805_create_mailboxer.mailboxer_engine.rb b/db/migrate/20140428223805_create_mailboxer.mailboxer_engine.rb new file mode 100644 index 0000000..690cec2 --- /dev/null +++ b/db/migrate/20140428223805_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/20140428223806_add_notified_object.mailboxer_engine.rb b/db/migrate/20140428223806_add_notified_object.mailboxer_engine.rb new file mode 100644 index 0000000..7f41ac6 --- /dev/null +++ b/db/migrate/20140428223806_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/20140428223807_add_notification_code.mailboxer_engine.rb b/db/migrate/20140428223807_add_notification_code.mailboxer_engine.rb new file mode 100644 index 0000000..04c12ef --- /dev/null +++ b/db/migrate/20140428223807_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/20140428223808_add_attachments.mailboxer_engine.rb b/db/migrate/20140428223808_add_attachments.mailboxer_engine.rb new file mode 100644 index 0000000..b8d6588 --- /dev/null +++ b/db/migrate/20140428223808_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/20140428223809_rename_receipts_read.mailboxer_engine.rb b/db/migrate/20140428223809_rename_receipts_read.mailboxer_engine.rb new file mode 100644 index 0000000..9ce904f --- /dev/null +++ b/db/migrate/20140428223809_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/20140428223810_add_global_notification_support.mailboxer_engine.rb b/db/migrate/20140428223810_add_global_notification_support.mailboxer_engine.rb new file mode 100644 index 0000000..60f67ab --- /dev/null +++ b/db/migrate/20140428223810_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/20140428223812_create_delayed_jobs.rb b/db/migrate/20140428223812_create_delayed_jobs.rb new file mode 100644 index 0000000..ec0dd93 --- /dev/null +++ b/db/migrate/20140428223812_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/20140428223815_create_servers.rb b/db/migrate/20140428223815_create_servers.rb new file mode 100644 index 0000000..fbe1b02 --- /dev/null +++ b/db/migrate/20140428223815_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/20140428223819_create_matches.rb b/db/migrate/20140428223819_create_matches.rb new file mode 100644 index 0000000..bac92d1 --- /dev/null +++ b/db/migrate/20140428223819_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/20140428223823_create_teams.rb b/db/migrate/20140428223823_create_teams.rb new file mode 100644 index 0000000..dd8397d --- /dev/null +++ b/db/migrate/20140428223823_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/20140428223827_create_alerts.rb b/db/migrate/20140428223827_create_alerts.rb new file mode 100644 index 0000000..68a8e10 --- /dev/null +++ b/db/migrate/20140428223827_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/20140428223830_create_pms.rb b/db/migrate/20140428223830_create_pms.rb new file mode 100644 index 0000000..eb9f443 --- /dev/null +++ b/db/migrate/20140428223830_create_pms.rb @@ -0,0 +1,13 @@ +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.text :subject + t.references :conversation, index: true + + t.timestamps + end + end +end diff --git a/db/migrate/20140428223834_create_tournaments.rb b/db/migrate/20140428223834_create_tournaments.rb new file mode 100644 index 0000000..f3715bb --- /dev/null +++ b/db/migrate/20140428223834_create_tournaments.rb @@ -0,0 +1,17 @@ +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.string :scoring_method + + t.timestamps + end + add_index :tournaments, :name, unique: true + end +end diff --git a/db/migrate/20140428223838_create_games.rb b/db/migrate/20140428223838_create_games.rb new file mode 100644 index 0000000..e841667 --- /dev/null +++ b/db/migrate/20140428223838_create_games.rb @@ -0,0 +1,16 @@ +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.string :scoring_method + + t.timestamps + end + add_index :games, :name, unique: true + end +end diff --git a/db/migrate/20140428223842_create_users.rb b/db/migrate/20140428223842_create_users.rb new file mode 100644 index 0000000..8032870 --- /dev/null +++ b/db/migrate/20140428223842_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/20140428223845_create_sessions.rb b/db/migrate/20140428223845_create_sessions.rb new file mode 100644 index 0000000..f667f1e --- /dev/null +++ b/db/migrate/20140428223845_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/20140428223849_create_brackets.rb b/db/migrate/20140428223849_create_brackets.rb new file mode 100644 index 0000000..8813bf2 --- /dev/null +++ b/db/migrate/20140428223849_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/20140428223853_create_game_settings.rb b/db/migrate/20140428223853_create_game_settings.rb new file mode 100644 index 0000000..06fb72e --- /dev/null +++ b/db/migrate/20140428223853_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/20140428223856_create_tournament_settings.rb b/db/migrate/20140428223856_create_tournament_settings.rb new file mode 100644 index 0000000..e56697f --- /dev/null +++ b/db/migrate/20140428223856_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/20140428223900_create_tournament_stages.rb b/db/migrate/20140428223900_create_tournament_stages.rb new file mode 100644 index 0000000..6e52bf0 --- /dev/null +++ b/db/migrate/20140428223900_create_tournament_stages.rb @@ -0,0 +1,12 @@ +class CreateTournamentStages < ActiveRecord::Migration + def change + create_table :tournament_stages do |t| + t.references :tournament, index: true + t.text :structure + t.string :scheduling_method + t.string :seeding_method + + t.timestamps + end + end +end diff --git a/db/migrate/20140428223903_create_statistics.rb b/db/migrate/20140428223903_create_statistics.rb new file mode 100644 index 0000000..09a435f --- /dev/null +++ b/db/migrate/20140428223903_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.text :json_value + + t.timestamps + end + end +end diff --git a/db/migrate/20140428223907_create_remote_usernames.rb b/db/migrate/20140428223907_create_remote_usernames.rb new file mode 100644 index 0000000..e265985 --- /dev/null +++ b/db/migrate/20140428223907_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/20140428223911_create_bracket_matches.rb b/db/migrate/20140428223911_create_bracket_matches.rb new file mode 100644 index 0000000..3323e31 --- /dev/null +++ b/db/migrate/20140428223911_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/20140428223914_create_api_requests.rb b/db/migrate/20140428223914_create_api_requests.rb new file mode 100644 index 0000000..544c330 --- /dev/null +++ b/db/migrate/20140428223914_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/20140428223918_create_tournament_players_join_table.rb b/db/migrate/20140428223918_create_tournament_players_join_table.rb new file mode 100644 index 0000000..be240e8 --- /dev/null +++ b/db/migrate/20140428223918_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/20140428223922_create_tournament_hosts_join_table.rb b/db/migrate/20140428223922_create_tournament_hosts_join_table.rb new file mode 100644 index 0000000..7521d89 --- /dev/null +++ b/db/migrate/20140428223922_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/20140428223925_create_team_user_join_table.rb b/db/migrate/20140428223925_create_team_user_join_table.rb new file mode 100644 index 0000000..f3b57fc --- /dev/null +++ b/db/migrate/20140428223925_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/20140428223929_create_match_team_join_table.rb b/db/migrate/20140428223929_create_match_team_join_table.rb new file mode 100644 index 0000000..c2ed1b7 --- /dev/null +++ b/db/migrate/20140428223929_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/20140428223939_add_hidden_attrs_to_user.rb b/db/migrate/20140428223939_add_hidden_attrs_to_user.rb new file mode 100644 index 0000000..9b5c505 --- /dev/null +++ b/db/migrate/20140428223939_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 a7910eb..c5032fa 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: 20140428133136) do +ActiveRecord::Schema.define(version: 20140428223939) do create_table "alerts", force: true do |t| t.integer "author_id" @@ -218,7 +218,7 @@ ActiveRecord::Schema.define(version: 20140428133136) do t.integer "user_id" t.integer "match_id" t.string "name" - t.integer "value" + t.text "json_value" t.datetime "created_at" t.datetime "updated_at" end diff --git a/test/fixtures/statistics.yml b/test/fixtures/statistics.yml index 0b5b113..e6bbccf 100644 --- a/test/fixtures/statistics.yml +++ b/test/fixtures/statistics.yml @@ -4,10 +4,10 @@ one: user_id: match_id: name: MyString - value: 1 + json_value: MyText two: user_id: match_id: name: MyString - value: 1 + json_value: MyText -- cgit v1.2.3 From 55f4c94d089ce622bd4fe0b4c915e8e4cb4122aa Mon Sep 17 00:00:00 2001 From: AndrewMurrell Date: Mon, 28 Apr 2014 19:32:32 -0400 Subject: changes to peer review and manual sampling --- lib/sampling/manual.html.erb | 11 +++++------ lib/sampling/manual.rb | 2 +- lib/sampling/peer_review.html.erb | 2 +- lib/sampling/peer_review.rb | 2 +- 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/lib/sampling/manual.html.erb b/lib/sampling/manual.html.erb index c9dd2fe..7b71c29 100644 --- a/lib/sampling/manual.html.erb +++ b/lib/sampling/manual.html.erb @@ -1,12 +1,11 @@ -<% if @tournament.hosts.include? current_user %> - +<% if @tournament.hosts.include? @current_user %> + <% @match.teams.each do |team| %> - <%= tag :input, {"type" => "radio", "name" => "winner", "value" => "#{team.id}" } %> + <%= "Team #{team.id} Won" %> <% end %> - - <%= submit_tag("Finish match") %> - <%= @tournament.settings['ScoringMethod'] %> +
+ <% else %>

The match is running; the host has yet to post the scores of the match.

<% end %> \ No newline at end of file diff --git a/lib/sampling/manual.rb b/lib/sampling/manual.rb index 1787cb7..4e86925 100644 --- a/lib/sampling/manual.rb +++ b/lib/sampling/manual.rb @@ -40,7 +40,7 @@ module Sampling erb_filename = File.join(__FILE__.sub(/\.rb$/, '.html.erb')) erb = ERB.new(File.read(erb_filename)) erb.filename = erb_filename - return erb.result.html_safe + return erb.result(binding).html_safe end def handle_user_interaction(user, sampling_params) diff --git a/lib/sampling/peer_review.html.erb b/lib/sampling/peer_review.html.erb index e744936..a0b9c4d 100644 --- a/lib/sampling/peer_review.html.erb +++ b/lib/sampling/peer_review.html.erb @@ -18,7 +18,7 @@ <%# TODO: display more statistics %> <% end %> - <%= submit_tag("Submit peer evaluation", :onsubmit => "score_peers()") %> + <% else %>

Still waiting for peer feedback from the following users:

    <% @feedbacks_missing.each do |user| %> diff --git a/lib/sampling/peer_review.rb b/lib/sampling/peer_review.rb index e86595f..1aabe34 100644 --- a/lib/sampling/peer_review.rb +++ b/lib/sampling/peer_review.rb @@ -39,7 +39,7 @@ module Sampling erb_filename = File.join(__FILE__.sub(/\.rb$/, '.html.erb')) erb = ERB.new(File.read(erb_filename)) erb.filename = erb_filename - return erb.result.html_safe + return erb.result(binding).html_safe end def handle_user_interaction(reviewing_user, params) -- cgit v1.2.3 From 8dade78c49ad03085166c41d8b334a6ade3a287e Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Mon, 28 Apr 2014 19:36:30 -0400 Subject: Hide the bullets for all unordered lists in forms --- .../stylesheets/application/scaffolds.css.scss | 4 ++ app/assets/stylesheets/patch | 54 ++++++++++++++++++++++ app/assets/stylesheets/servers.css.scss | 5 -- app/assets/stylesheets/users.css.scss | 5 -- 4 files changed, 58 insertions(+), 10 deletions(-) create mode 100644 app/assets/stylesheets/patch diff --git a/app/assets/stylesheets/application/scaffolds.css.scss b/app/assets/stylesheets/application/scaffolds.css.scss index ae26907..703e3d6 100644 --- a/app/assets/stylesheets/application/scaffolds.css.scss +++ b/app/assets/stylesheets/application/scaffolds.css.scss @@ -115,6 +115,10 @@ fieldset { } } +form ul { + list-style: none; +} + a, button, input[type="submit"] { @extend .btn; &.user { @extend .btn-info; } diff --git a/app/assets/stylesheets/patch b/app/assets/stylesheets/patch new file mode 100644 index 0000000..0997417 --- /dev/null +++ b/app/assets/stylesheets/patch @@ -0,0 +1,54 @@ +commit 10f01633176ca214e7aec6be61ed3344035ec77e +Merge: 99dff7e 20f7b74 +Author: webb39 +Date: Mon Mar 10 20:41:27 2014 -0400 + + Merge branch 'master' of https://github.com/LukeShu/Leaguer + +commit 99dff7e01a65986338824804651367e97a0d1923 +Merge: 1f00553 f0c03cd +Author: webb39 +Date: Mon Mar 10 20:41:16 2014 -0400 + + Merge https://github.com/LukeShu/Leaguer + + Conflicts: + doc/Sprint1-Retrospective.md + +commit 1f00553cbc5d281efe3ac1b434d16537a17bc969 +Author: webb39 +Date: Mon Mar 10 20:36:31 2014 -0400 + + added match controller information + +diff --git a/doc/Sprint1-Retrospective.md b/doc/Sprint1-Retrospective.md +index 3da3669..ae1b07a 100644 +--- a/doc/Sprint1-Retrospective.md ++++ b/doc/Sprint1-Retrospective.md +@@ -97,13 +97,24 @@ f + f + + ## Login (UI) {#login-ui} +- ++ + ## Tournament settings {#tourney-settings} +- ++ + ## Tournament registration {#tourney-registration} + + ## Match controller {#match-controller} + ++The Match Controller creates the separate matches for a specific tournament. ++When a tournament is started, it begins with an initial match that contains ++no players. Currently, a player must join a match by entering the specific ++tournament (by clicking the 'show' button on the tournament), ++then they must enter the match (again by clicking the 'show' button but this ++time on the match they desire to participate in) and then finally clicking ++the 'join' button. This updates the match with the user as a participant in ++the matc and then finally clicking the 'join' button. This updates the match ++with the user as a participant in the match. A match can also be destroyed ++by clicking the 'delete' button on the no longer desired match on the page. ++ + ## Permissions system {#permissions} + + ## Tournament view {#tourney-view} diff --git a/app/assets/stylesheets/servers.css.scss b/app/assets/stylesheets/servers.css.scss index bb20956..e69de29 100644 --- a/app/assets/stylesheets/servers.css.scss +++ b/app/assets/stylesheets/servers.css.scss @@ -1,5 +0,0 @@ -.edit_server { - li { - list-style: none; - } -} diff --git a/app/assets/stylesheets/users.css.scss b/app/assets/stylesheets/users.css.scss index 790aa5f..e69de29 100644 --- a/app/assets/stylesheets/users.css.scss +++ b/app/assets/stylesheets/users.css.scss @@ -1,5 +0,0 @@ -.new_user, .edit_user { - li { - list-style: none; - } -} -- cgit v1.2.3