summaryrefslogtreecommitdiff
path: root/app/controllers
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/matches_controller.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/app/controllers/matches_controller.rb b/app/controllers/matches_controller.rb
index 93b5514..97b8b83 100644
--- a/app/controllers/matches_controller.rb
+++ b/app/controllers/matches_controller.rb
@@ -193,6 +193,20 @@ class MatchesController < ApplicationController
end
end
when "finish"
+ order = params[:review_action]
+ base_score = 2
+ next_score = 3
+ order.split(",").reverse.each do |elem|
+ player_score = base_score
+ if @match.winner.user.include?(@current_user)
+ player_score += 10
+ else
+ player_score += 7
+ end
+ Score.create(user: elem, match: @match, value: player_score )
+ base_score = next_score
+ next_score += base_score
+ end
@match.status = 3
respond_to do |format|
if @match.save