summaryrefslogtreecommitdiff
path: root/app/models
diff options
context:
space:
mode:
authorLuke Shumaker <shumakl@purdue.edu>2014-04-27 22:56:44 -0400
committerLuke Shumaker <shumakl@purdue.edu>2014-04-27 22:56:44 -0400
commitc52a612c3b713c6fbae0cbdc7a1f1cd5cd999c24 (patch)
tree30b92254a4de3105a104028f34f8023d5ccbb8b9 /app/models
parente46b38a457cf9cc685f644be741073df183f53b2 (diff)
Re-jig the match life-cycle
Diffstat (limited to 'app/models')
-rw-r--r--app/models/match.rb40
1 files changed, 9 insertions, 31 deletions
diff --git a/app/models/match.rb b/app/models/match.rb
index 9045d67..c2df6e0 100644
--- a/app/models/match.rb
+++ b/app/models/match.rb
@@ -5,41 +5,19 @@ class Match < ActiveRecord::Base
belongs_to :winner, class_name: "Team"
- def setup()
-
+ def win?(player)
+ winner.players.include? player
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 handle_sampling(params)
+ # TODO
end
- #handle_asynchronously :is_match_over
- def win?(player)
- winner.players.include? player
+ def render_sampling(user)
+ # TODO
end
+ def finished?
+ # TODO
+ end
end