summaryrefslogtreecommitdiff
path: root/app/models
diff options
context:
space:
mode:
authorguntasgrewal <guntasgrewal@gmail.com>2014-04-27 23:26:24 -0400
committerguntasgrewal <guntasgrewal@gmail.com>2014-04-27 23:26:24 -0400
commit1c37ae521e29a5e0869aba52d324ed0cd4a830a6 (patch)
treee4488ed3feb5e5dc94a72cd46cff2aeef0dcd1f8 /app/models
parent6cbf08bb7659dc3265b45d05a66170f1c69ce696 (diff)
parent4c572a775a7c28b102b4462af94214148e6df1d2 (diff)
Merge branch 'master' of https://github.com/LukeShu/leaguer
Diffstat (limited to 'app/models')
-rw-r--r--app/models/match.rb44
1 files changed, 16 insertions, 28 deletions
diff --git a/app/models/match.rb b/app/models/match.rb
index 9045d67..d4c0ce5 100644
--- a/app/models/match.rb
+++ b/app/models/match.rb
@@ -6,40 +6,28 @@ class Match < ActiveRecord::Base
belongs_to :winner, class_name: "Team"
def setup()
-
end
- def is_match_over(match, firstPlayer)
- #response = HTTParty.get("https://prod.api.pvp.net/api/lol/na/v1.3/summoner/by-name/#{firstPlayer}?api_key=ad539f86-22fd-474d-9279-79a7a296ac38")
- #riot_id = response["#{firstPlayer}"]['id']
- #recent game information
- #game_info = HTTParty.get("https://prod.api.pvp.net/api/lol/na/v1.3/game/by-summoner/#{riot_id}/recent?api_key=ad539f86-22fd-474d-9279-79a7a296ac38")
- #first_id = game_info["games"][0]["gameId"]
-
- count = 0
- while true do
- #sleep(5) #wait four minutes
-
- puts("Every 4 minutes.")
- puts("Every 4 minutes.")
- count += 1
- #game_info = HTTParty.get("https://prod.api.pvp.net/api/lol/na/v1.3/game/by-summoner/#{riot_id}/recent?api_key=ad539f86-22fd-474d-9279-79a7a296ac38")
- #current_id = game_info["games"][0]["gameId"]
-
- #if current_id != first_id
- if count > 2
- puts(count)
- #sleep(10)
- match.status = 2
- match.save
- return true
- end
- end #while
+ def finished?
+ ok = true
+ tournament_stage.scoring_method.stats_needed.each do |stat|
+ ok &= statistics.where(match: self, name: stat).nil?
+ ok
end
- #handle_asynchronously :is_match_over
def win?(player)
winner.players.include? player
end
+ def handle_sampling(params)
+ # TODO
+ end
+
+ def render_sampling(user)
+ # TODO
+ end
+
+ def finished?
+ # TODO
+ end
end