From 4ac5229d216bd6d18a2b6e39bf90f76cbdfbb7c3 Mon Sep 17 00:00:00 2001
From: AndrewMurrell <amurrel@purdue.edu>
Date: Sun, 6 Apr 2014 23:48:45 -0400
Subject: Fixed Preferences.

---
 app/models/tournament.rb | 22 +++++++++++++++++++---
 1 file changed, 19 insertions(+), 3 deletions(-)

(limited to 'app/models')

diff --git a/app/models/tournament.rb b/app/models/tournament.rb
index fdcdba2..3e85744 100644
--- a/app/models/tournament.rb
+++ b/app/models/tournament.rb
@@ -16,6 +16,14 @@ class Tournament < ActiveRecord::Base
 	end
 
 	class Preferences
+		@vartypes = {
+			:true_false => 0,
+			:integer => 1,
+			:string => 2,
+			:select => 3,
+			:range => 4
+		}
+
                 def initialize(tournament)
                         @tournament = tournament
                 end
@@ -29,15 +37,23 @@ class Tournament < ActiveRecord::Base
                         end
                 end
 
-                def []=(preference, value)
+                def []=(preference, val)
                         p = @tournament.preferences_raw.find_by_name(preference)
                         if p.nil?
-                                # TODO: create it
+				TournamentPreference.create( tournament_id: @tournament.id, vartype: get_type(val), name: preference, value: val )
                         else
-                                p.value = value
+                                p.value = val
                         end
                 end
 
+		def get_type(val) {
+			return vartypes[:true_false] if val == "true" or val == "false"
+			return vartypes[:range] if /\d+-\d+/ =~ val
+			return vartypes[:integer] if /\d+/ =~ val
+			return vartypes[:select] if /,/ =~ val
+			return vartypes[:string]
+		}
+
                 def keys
                         @tournament.preferences_raw.all.collect { |x| x.name }
                 end
-- 
cgit v1.2.3-2-g168b


From fd3308f9aacc9efb2a2692dbff8090dfcd663c88 Mon Sep 17 00:00:00 2001
From: guntasgrewal <guntasgrewal@gmail.com>
Date: Mon, 7 Apr 2014 00:51:27 -0400
Subject: Matches move forward more

---
 app/models/user.rb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'app/models')

diff --git a/app/models/user.rb b/app/models/user.rb
index 0446b35..3407355 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -111,7 +111,7 @@ class User < ActiveRecord::Base
 
 	# VALID_USER_NAME checks to make sure a user's user_name
 	# is in the proper format.
-	VALID_USER_NAME_REG = /\A[a-zA-Z0-9\-]+\z/
+	VALID_USER_NAME_REG = /\A[a-zA-Z0-9 _\-]+\z/
 
 	# The following lines put a user account through a series of
 	# validations in order to make sure all of their information
-- 
cgit v1.2.3-2-g168b