Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

polish calc_team scoring cont.

  • Loading branch information...
commit 7f080fd933f16d4806884488fa35f86122058173 1 parent 6d512a0
Gerald Bauer geraldb authored
Showing with 15 additions and 10 deletions.
  1. +10 −9 app/models/calc_tip.rb
  2. +5 −1 lib/backup.rb
19 app/models/calc_tip.rb
View
@@ -24,21 +24,15 @@
class CalcTip < Tip
- after_initialize :do_after_initialize
+ after_initialize :on_after_initialize
belongs_to :calc_team1, :class_name => 'Team', :foreign_key => 'calc_team1_id'
belongs_to :calc_team2, :class_name => 'Team', :foreign_key => 'calc_team2_id'
-private
-
- def do_after_initialize
- self.calc = true # make sure calc flag is true
- end
-
## note: use different calc forumula
# check for matching teams first
# before checking scoring
-
+
def calc_points
pts = 0
@@ -67,6 +61,13 @@ def calc_points
end
pts
end
-
+
+
+private
+
+ def on_after_initialize
+ self.calc = true # make sure calc flag is true
+ end
+
end # class CalcTip
6 lib/backup.rb
View
@@ -8,7 +8,11 @@ def update_import_export_keys
puts "## Games"
Game.all.each do |game|
- game.key = "#{game.round.event.key}+#{game.round.pos}+#{game.team1.key}+#{game.team2.key}"
+ if game.calc?
+ game.key = "#{game.round.event.key}+#{game.round.pos}+calc+#{game.team1.key}+#{game.team2.key}"
+ else
+ game.key = "#{game.round.event.key}+#{game.round.pos}+#{game.team1.key}+#{game.team2.key}"
+ end
game.job_running!
game.save!
game.job_done!
Please sign in to comment.
Something went wrong with that request. Please try again.