Permalink
Browse files

polish new pools

  • Loading branch information...
1 parent 8859436 commit fc6ec0820f930e4a1c0838122032953fba8ae36b @geraldb geraldb committed Jul 8, 2012
@@ -6,7 +6,7 @@ def index
# find next upcoming games
- limit = params[:limit] || '8'
+ limit = params[:limit] || '12'
@upcoming_games = Game.where( 'play_at > ?', Time.now ).order( 'play_at').limit(limit)
@past_games = Game.where( 'play_at < ?', Time.now ).order( 'play_at desc').limit(limit)
View
@@ -51,7 +51,7 @@ def self.create_from_ary!( teams )
end
Team.create!( attr )
- end # each teams
+ end # each team
end
View
@@ -30,5 +30,25 @@ def on_before_save
self.key = email.gsub( /[\s\.\-+_]/, '' ).downcase
end
end
+
+ def self.create_from_ary!( users )
+ users.each do |values|
+
+ attr = {
+ :name => values[0],
+ :email => values[1],
+ :password => 'tipp'
+ }
+
+ ## check for optional values
+ opts = values[2]
+ if opts
+ attr[ :admin ] = opts[ :admin ] if opts.has_key?( :admin )
+ attr[ :guest ] = opts[ :guest ] if opts.has_key?( :guest )
+ end
+
+ User.create!( attr )
+ end # each user
+ end
end # class User
@@ -2,5 +2,8 @@
<span class='<%= game.team1_style_class %>'>
<%= link_to game.team1.title, live_game_path(game.id) %>
</span>
+ <span>
+ <%= "(#{game.team1.title2})" if game.team1.title2.present? %>
+ </span>
<%= image_tag( game.team1.img ) if game.team1.img.present? %>
</td>
@@ -3,4 +3,7 @@
<span class='<%= game.team2_style_class %>'>
<%= link_to game.team2.title, live_game_path(game.id) %>
</span>
+ <span>
+ <%= "(#{game.team2.title2})" if game.team2.title2.present? %>
+ </span>
</td>
@@ -21,6 +21,7 @@
</td>
<td style='text-align: right;'>
<%= link_to game.team1.title, live_game_path( game.id ) %>
+ <%= "(#{game.team1.title2})" if game.team1.title2.present? %>
</td>
<td>
<%= image_tag( game.team1.img ) if game.team1.img.present? %>
@@ -32,6 +33,7 @@
</td>
<td>
<%= link_to game.team2.title, live_game_path( game.id ) %>
+ <%= "(#{game.team2.title2})" if game.team2.title2.present? %>
</td>
<td>
(<%= game.round.event.title %> / <%= game.round.title %>)
@@ -128,35 +128,35 @@
games_cuprunde1 = [
- [ 1, fac, [], altach, Time.cet('2012-07-12 19:00') ],
- [ 2, hard, [], schwaz, Time.cet('2012-07-13 18:30') ],
- [ 3, dsc, [], hartberg, Time.cet('2012-07-13 19:00') ],
+# [ 1, fac, [], altach, Time.cet('2012-07-12 19:00') ],
+# [ 2, hard, [], schwaz, Time.cet('2012-07-13 18:30') ],
+# [ 3, dsc, [], hartberg, Time.cet('2012-07-13 19:00') ],
[ 4, gratkorn, [], wacker, Time.cet('2012-07-13 19:00') ],
- [ 5, pasching, [], austrias, Time.cet('2012-07-13 19:00') ],
+# [ 5, pasching, [], austrias, Time.cet('2012-07-13 19:00') ],
[ 6, parndorf, [], admira, Time.cet('2012-07-13 19:00') ],
- [ 7, voecklamarkt, [], lustenau, Time.cet('2012-07-13 19:00') ],
- [ 8, kalsdorf, [], wallern, Time.cet('2012-07-13 19:00') ],
+# [ 7, voecklamarkt, [], lustenau, Time.cet('2012-07-13 19:00') ],
+# [ 8, kalsdorf, [], wallern, Time.cet('2012-07-13 19:00') ],
[ 9, wattens, [], sturm, Time.cet('2012-07-13 19:00') ],
- [ 10, vsv, [], rohrendorf, Time.cet('2012-07-13 19:00') ],
- [ 11, pinzgau, [], groedig, Time.cet('2012-07-13 19:15') ],
- [ 12, amstetten, [], schwechat, Time.cet('2012-07-13 19:30') ],
- [ 13, stflorian, [], linz, Time.cet('2012-07-13 19:30') ],
- [ 14, austriak, [], horn, Time.cet('2012-07-13 19:30') ],
- [ 15, sak, [], allerheiligen, Time.cet('2012-07-13 19:30') ],
- [ 16, gak, [], vienna, Time.cet('2012-07-13 20:00') ],
+# [ 10, vsv, [], rohrendorf, Time.cet('2012-07-13 19:00') ],
+# [ 11, pinzgau, [], groedig, Time.cet('2012-07-13 19:15') ],
+# [ 12, amstetten, [], schwechat, Time.cet('2012-07-13 19:30') ],
+# [ 13, stflorian, [], linz, Time.cet('2012-07-13 19:30') ],
+# [ 14, austriak, [], horn, Time.cet('2012-07-13 19:30') ],
+# [ 15, sak, [], allerheiligen, Time.cet('2012-07-13 19:30') ],
+# [ 16, gak, [], vienna, Time.cet('2012-07-13 20:00') ],
[ 17, wienersk, [], salzburg, Time.cet('2012-07-13 20:30') ],
- [ 18, stegersbach, [], reutte, Time.cet('2012-07-14 17:00') ],
- [ 19, badvoeslau, [], stpoelten, Time.cet('2012-07-14 17:00') ],
- [ 20, micheldorf, [], viktoria, Time.cet('2012-07-14 17:00') ],
- [ 21, klagenfurt, [], stjohann, Time.cet('2012-07-14 18:00') ],
- [ 22, lask, [], spittal, Time.cet('2012-07-14 18:00') ],
+# [ 18, stegersbach, [], reutte, Time.cet('2012-07-14 17:00') ],
+# [ 19, badvoeslau, [], stpoelten, Time.cet('2012-07-14 17:00') ],
+# [ 20, micheldorf, [], viktoria, Time.cet('2012-07-14 17:00') ],
+# [ 21, klagenfurt, [], stjohann, Time.cet('2012-07-14 18:00') ],
+# [ 22, lask, [], spittal, Time.cet('2012-07-14 18:00') ],
[ 23, ostbahn, [], wac, Time.cet('2012-07-14 18:00') ],
- [ 24, gaflenz, [], sollenau, Time.cet('2012-07-14 18:00') ],
+# [ 24, gaflenz, [], sollenau, Time.cet('2012-07-14 18:00') ],
[ 25, oberwart, [], austria, Time.cet('2012-07-14 18:00') ],
[ 26, leoben, [], mattersburg, Time.cet('2012-07-14 18:00') ],
- [ 27, retz, [], austrial, Time.cet('2012-07-14 18:00') ],
- [ 28, bregenz, [], ksv, Time.cet('2012-07-14 18:30') ],
- [ 29, ardagger, [], dornbirn, Time.cet('2012-07-14 19:00') ],
+# [ 27, retz, [], austrial, Time.cet('2012-07-14 18:00') ],
+# [ 28, bregenz, [], ksv, Time.cet('2012-07-14 18:30') ],
+# [ 29, ardagger, [], dornbirn, Time.cet('2012-07-14 19:00') ],
[ 30, kufstein, [], ried, Time.cet('2012-07-14 19:00') ],
[ 31, wolfurt, [], neustadt, Time.cet('2012-07-15 10:30') ],
[ 32, heiligenkreuz,[], rapid, Time.cet('2012-07-15 18:00') ]
@@ -2,12 +2,12 @@
puts "*** loading seed data in seeds/uss/euro_bonus.rb"
-behrooz = User.find_by_key!( 'behroozs' )
+nn = User.find_by_key!( 'nn' )
euro = Event.find_by_key!( 'euro')
-poolfix = Pool.find_by_event_id_and_user_id_and_fix!( euro.id, behrooz.id, true )
-poolflex = Pool.find_by_event_id_and_user_id_and_fix!( euro.id, behrooz.id, false )
+poolfix = Pool.find_by_event_id_and_user_id_and_fix!( euro.id, nn.id, true )
+poolflex = Pool.find_by_event_id_and_user_id_and_fix!( euro.id, nn.id, false )
rfix1 = BonusRound.create!( :pool_id => poolfix.id, :pos => 1, :title => 'Bonuspunkte - Gruppenplazierung' )
rfix2 = BonusRound.create!( :pool_id => poolfix.id, :pos => 2, :title => 'Bonuspunkte - Europa- und Vizemeister' )
@@ -1,12 +1,12 @@
puts "*** loading seed data in seeds/uss/euro_bonus2.rb"
-behrooz = User.find_by_key!( 'behroozs' )
+nn = User.find_by_key!( 'nn' )
euro = Event.find_by_key!( 'euro')
-poolfix = Pool.find_by_event_id_and_user_id_and_fix!( euro.id, behrooz.id, true )
-poolflex = Pool.find_by_event_id_and_user_id_and_fix!( euro.id, behrooz.id, false )
+poolfix = Pool.find_by_event_id_and_user_id_and_fix!( euro.id, nn.id, true )
+poolflex = Pool.find_by_event_id_and_user_id_and_fix!( euro.id, nn.id, false )
rfix = BonusRound.find_by_pool_id_and_pos!( poolfix.id, 2 )
qfix = BonusQuestion.find_by_round_id_and_pos!( rfix.id, 1 )
View
@@ -1,46 +1,3 @@
########################
# backup data plays
-#
-# Export 2012-05-28 20:52:55 +0000
-play-3,clemens,euro+fix+behrooz,england,germany,
-play-8,clemens,euro+flex+behrooz,england,germany,
-
-########################
-# backup data tips
-
-tip-1,clemens,euro+fix+behrooz,euro+1+poland+greece,2,1,,,,
-tip-2,clemens,euro+fix+behrooz,euro+1+russia+czech,1,1,,,,
-tip-9,clemens,euro+fix+behrooz,euro+2+greece+czech,0,2,,,,
-tip-10,clemens,euro+fix+behrooz,euro+2+poland+russia,1,3,,,,
-tip-17,clemens,euro+fix+behrooz,euro+3+greece+russia,0,2,,,,
-tip-18,clemens,euro+fix+behrooz,euro+3+czech+poland,3,1,,,,
-tip-4,clemens,euro+fix+behrooz,euro+1+germany+portugal,2,1,,,,
-tip-11,clemens,euro+fix+behrooz,euro+2+denmark+portugal,1,1,,,,
-tip-12,clemens,euro+fix+behrooz,euro+2+netherlands+germany,3,2,,,,
-tip-19,clemens,euro+fix+behrooz,euro+3+portugal+netherlands,2,2,,,,
-tip-20,clemens,euro+fix+behrooz,euro+3+denmark+germany,1,3,,,,
-tip-5,clemens,euro+fix+behrooz,euro+1+spain+italy,1,2,,,,
-tip-13,clemens,euro+fix+behrooz,euro+2+italy+croatia,3,1,,,,
-tip-14,clemens,euro+fix+behrooz,euro+2+spain+ireland,2,0,,,,
-tip-21,clemens,euro+fix+behrooz,euro+3+croatia+spain,1,3,,,,
-tip-22,clemens,euro+fix+behrooz,euro+3+italy+ireland,4,1,,,,
-tip-7,clemens,euro+fix+behrooz,euro+1+france+england,2,3,,,,
-tip-8,clemens,euro+fix+behrooz,euro+1+ukraine+sweden,1,2,,,,
-tip-16,clemens,euro+fix+behrooz,euro+2+ukraine+france,3,1,,,,
-tip-23,clemens,euro+fix+behrooz,euro+3+england+ukraine,4,0,,,,
-tip-24,clemens,euro+fix+behrooz,euro+3+sweden+france,2,3,,,,
-tip-25,clemens,euro+fix+behrooz,euro+4+euro1a+euro2b,0,4,,,,
-tip-27,clemens,euro+fix+behrooz,euro+4+euro1c+euro2d,2,1,,,,
-tip-28,clemens,euro+fix+behrooz,euro+4+euro1d+euro2c,1,1,1,1,5,4
-tip-29,clemens,euro+fix+behrooz,euro+5+euro25+euro27,1,1,2,2,3,2
-tip-31,clemens,euro+fix+behrooz,euro+6+euro29+euro30,1,1,1,1,3,4
-tip-3,clemens,euro+fix+behrooz,euro+1+netherlands+denmark,4,1,,,,
-tip-6,clemens,euro+fix+behrooz,euro+1+ireland+croatia,0,2,,,,
-tip-15,clemens,euro+fix+behrooz,euro+2+sweden+england,2,2,,,,
-tip-26,clemens,euro+fix+behrooz,euro+4+euro1b+euro2a,2,2,2,2,4,3
-tip-30,clemens,euro+fix+behrooz,euro+5+euro26+euro28,1,2,,,,
-tip-174,clemens,euro+flex+behrooz,euro+1+russia+czech,2,2,,,,
-tip-176,clemens,euro+flex+behrooz,euro+1+germany+portugal,1,1,,,,
-tip-173,clemens,euro+flex+behrooz,euro+1+poland+greece,2,1,,,,
-tip-175,clemens,euro+flex+behrooz,euro+1+netherlands+denmark,3,1,,,,
View
@@ -7,15 +7,11 @@
euro = Event.find_by_key!( 'euro' )
-behrooz = User.find_by_key!( 'behrooz' )
+nn = User.find_by_key!( 'nn' )
-pool1 = Pool.create!( :event => euro, :title => '(1) USS EF', :user => behrooz, :public => false, :fix => true,
+pool1 = Pool.create!( :event => euro, :title => '(1) USS EF', :user => nn, :public => false, :fix => true,
:welcome => <<EOS )
Spielart Variante 1) Man tippt vor Anpfiff alle Spiele bis zum Finale durch.
-Ein Ausdruck ist bei Behrooz SEIFI
-__spätestens am Do. 7. Juni 2012__ abzugeben (inkl. Teilnahmegebühr[^1]).
-
-[^1]: Kinder ausgenommen.
<!-- more -->
@@ -28,21 +24,16 @@
* Ein Punkt bei Elfmeter für den richtigen Tipp (1/2).
* Drei Punkte für den richtigen Europameister.
* Zwei Punkte für den richtigen Vizemeister.
-
-Alle Tipps und die Auswertungen werden ab Do. 7. Juni Nachmittag freigeschaltet.
EOS
-pool2 = Pool.create!( :event => euro, :title => '(2) USS EF', :user => behrooz, :public => false,
+pool2 = Pool.create!( :event => euro, :title => '(2) USS EF', :user => nn, :public => false,
:welcome => <<EOS )
Spielart Variante 2) Man tippt am Anfang den Europameister und Vizemeister und danach
-__jedes Spiel spätestens am Spieltag bis 17 Uhr__[^1].
-
-[^1]: Teilnahme nur möglich, wenn man in der Variante 1 mitmacht.
+__jedes Spiel spätestens am Spieltag bis 17 Uhr__.
<!-- more -->
-
Punkte:
* Ein Punkt für den richtigen Tipp (1/X/2).
@@ -53,8 +44,8 @@
* Zwei Punkte für den richtigen Vizemeister.
EOS
-pool1.players << behrooz # also auto add admin as first player
-pool2.players << behrooz
+pool1.players << nn # also auto add admin as first player
+pool2.players << nn
## todo: use new version constant for app module e.g. Wettpool::VERSION ??
View
@@ -1,39 +0,0 @@
-# encoding: utf-8
-
-puts "*** loading seed data in seeds/uss/tips_euro.rb"
-
-
-gerald = User.find_by_key!( 'gerald' )
-guersel = User.find_by_key!( 'gürsel' )
-behrooz = User.find_by_key!( 'behrooz' )
-
-euro = Event.find_by_key!( 'euro')
-
-pool1 = Pool.find_by_event_id_and_user_id_and_fix!( euro.id, behrooz.id, true )
-
-pool1.players << gerald
-pool1.players << guersel
-
-
-euroa = Group.find_by_event_id_and_pos!( euro.id, 1 )
-
-g1 = Game.find_by_group_id_and_pos!( euroa.id, 1 )
-g2 = Game.find_by_group_id_and_pos!( euroa.id, 2 )
-g9 = Game.find_by_group_id_and_pos!( euroa.id, 9 )
-g10 = Game.find_by_group_id_and_pos!( euroa.id, 10 )
-
-g1.update_attributes!( :score1 => 1, :score2 => 2 )
-g2.update_attributes!( :score1 => 0, :score2 => 0 )
-g9.update_attributes!( :score1 => 2, :score2 => 3 )
-g10.update_attributes!( :score1 => 2, :score2 => 1 )
-
-Tip.create!( :user => gerald, :pool => pool1, :game => g1, :score1 => 2, :score2 => 4 ) # bingo
-Tip.create!( :user => gerald, :pool => pool1, :game => g2, :score1 => 1, :score2 => 1 ) # bingoo
-Tip.create!( :user => gerald, :pool => pool1, :game => g9, :score1 => 2, :score2 => 3 ) # bingooo
-Tip.create!( :user => gerald, :pool => pool1, :game => g10, :score1 => 0, :score2 => 2 )
-
-Tip.create!( :user => guersel, :pool => pool1, :game => g1, :score1 => 2, :score2 => 3 )
-Tip.create!( :user => guersel, :pool => pool1, :game => g2, :score1 => 1, :score2 => 4 )
-
-## todo: use new version constant for app module e.g. Wettpool::VERSION ??
-Prop.create!( :key => 'db.seeds.uss.euro.tips.version', :value => '1' )
Oops, something went wrong.

0 comments on commit fc6ec08

Please sign in to comment.