From 55f1d11f66f216f0aff40fbe3ba90373339beb55 Mon Sep 17 00:00:00 2001 From: tkimia Date: Mon, 7 Apr 2014 02:48:17 -0400 Subject: profiles updated --- app/views/matches/index.html.erb | 3 ++- app/views/users/show.html.erb | 36 ++++++++++++++++++++++++++++++------ 2 files changed, 32 insertions(+), 7 deletions(-) (limited to 'app') diff --git a/app/views/matches/index.html.erb b/app/views/matches/index.html.erb index def97ba..78c97bb 100644 --- a/app/views/matches/index.html.erb +++ b/app/views/matches/index.html.erb @@ -38,7 +38,8 @@ + xmlns="http://www.w3.org/2000/svg" + xmlns:xlink="http://www.w3.org/1999/xlink"> <% lastrx = 0 lastry = 0 lastrh = 0 diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index 7bda009..c2b5c75 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -1,10 +1,8 @@ -

- <%= image_tag 'http://www.gravatar.com/avatar/' + Digest::MD5.hexdigest(@user.email) + '?s=100&d=mm' %> -

+ +

<%= @user.user_name %>'s Profile

- Name: - <%= @user.name %> + <%= image_tag 'http://www.gravatar.com/avatar/' + Digest::MD5.hexdigest(@user.email) + '?s=100&d=mm' %>

@@ -13,9 +11,35 @@

- User name: + Preferred name: <%= @user.user_name %>

+

+ Relationship Status: + too single +

+ +
+
+

Recent Tournaments Players

+
    + <% @user.tournaments_played.each do |t| %> +
  • <%= t.name %>
  • + <% end %> +
+
+
+

Recent Tournaments Hosted

+ <% if @user.tournaments_hosted.count == 0 %>

<%= @user.user_name %> has never hosted a tournament

<%end %> +
    + <% @user.tournaments_hosted.each do |t| %> +
  • <%= t.name %>
  • + <% end %> +
+
+
+ + <%= link_to 'Edit', edit_user_path(@user) %> | <%= link_to 'Users', users_path %> -- cgit v1.2.3-54-g00ecf From 29df65e51b2cb38e31b1c377c536e7bba1eecc90 Mon Sep 17 00:00:00 2001 From: AndrewMurrell Date: Mon, 7 Apr 2014 02:57:59 -0400 Subject: Updated Peer Review -- Now allows review and scoring -- not tested because Davis can not yaml. --- app/controllers/matches_controller.rb | 14 ++++++++++++++ app/views/matches/show.html.erb | 19 +++++++++++++++++-- app/views/tournaments/_selected.html.erb | 4 ++-- 3 files changed, 33 insertions(+), 4 deletions(-) (limited to 'app') 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 diff --git a/app/views/matches/show.html.erb b/app/views/matches/show.html.erb index cd30926..a0540f9 100644 --- a/app/views/matches/show.html.erb +++ b/app/views/matches/show.html.erb @@ -117,7 +117,7 @@ <% if @tournament.players.include?(current_user) %>
- <%= form_tag(tournament_match_path(@tournament, @match), method: "put") do %> + <%= form_tag(tournament_match_path(@tournament, @match), method: "put", name: "peeris") do %> <% case @match.status %> <% when 0 %> @@ -126,8 +126,9 @@ <%= submit_tag("Begin Peer Evaluation") %> <% when 2 %> + - <%= submit_tag("End Match") %> + <%= submit_tag("End Peer Evaluation", :onsubmit => "score_peers()") %> <% when 3 %> <%= submit_tag("Reset Status") %> @@ -136,3 +137,17 @@
<% end %> + + + + diff --git a/app/views/tournaments/_selected.html.erb b/app/views/tournaments/_selected.html.erb index d37c741..1be1adf 100644 --- a/app/views/tournaments/_selected.html.erb +++ b/app/views/tournaments/_selected.html.erb @@ -23,9 +23,9 @@ <% when 0 %> <%= setting_fields.text_field( setting.name, :name ) %> <% when 1 %> - <%= setting_fields.text_area( setting.name, setting.name ) %> + <%#setting_fields.text_area( setting.name, setting.name ) %> <% when 2 %> - <%= setting_fields.collection_radio_buttons( setting.name, setting.type_opt.split(',') ) %> + <%#setting_fields.collection_radio_buttons( setting.name, setting.type_opt.split(',') ) %> <% when 3 %> <%= setting_fields.collection_check_boxes( setting.name, setting.type_opt.split(',') ) %> <% when 4 %> -- cgit v1.2.3-54-g00ecf From 22d74ce5b34140b353d43a1848fe51eaaa254d84 Mon Sep 17 00:00:00 2001 From: AndrewMurrell Date: Mon, 7 Apr 2014 03:28:37 -0400 Subject: updated matches controller and added hooks --- app/controllers/matches_controller.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'app') diff --git a/app/controllers/matches_controller.rb b/app/controllers/matches_controller.rb index 97b8b83..fc44e35 100644 --- a/app/controllers/matches_controller.rb +++ b/app/controllers/matches_controller.rb @@ -207,7 +207,10 @@ class MatchesController < ApplicationController base_score = next_score next_score += base_score end - @match.status = 3 + @match.submitted_peer_reviews += 1 + if (@match.submitted_peer_reviews == @match.players.count) + @match.status = 3 + end respond_to do |format| if @match.save format.html { redirect_to tournament_match_path(@tournament, @match), notice: 'Peer Review Submitted' } -- cgit v1.2.3-54-g00ecf From fea1311388477583b31fa3214a7241a7322f494a Mon Sep 17 00:00:00 2001 From: AndrewMurrell Date: Mon, 7 Apr 2014 03:35:49 -0400 Subject: Updated Generate and Re-added hoooks --- app/controllers/matches_controller.rb | 11 ++++++----- generate.sh | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) (limited to 'app') diff --git a/app/controllers/matches_controller.rb b/app/controllers/matches_controller.rb index fc44e35..9c0a740 100644 --- a/app/controllers/matches_controller.rb +++ b/app/controllers/matches_controller.rb @@ -147,11 +147,12 @@ class MatchesController < ApplicationController if (@match.status == 1) @scores = @match.scores end - file_blue = "blue.yaml" - file_purple = "purple.yaml" - @blue2 = YAML.load_file(file_blue) - @purp2 = YAML.load_file(file_purple) - + if Tournament.find_by_id(@match.tournament_id).game_id == 1 + file_blue = "blue.yaml" + file_purple = "purple.yaml" + @blue2 = YAML.load_file(file_blue) + @purp2 = YAML.load_file(file_purple) + end end def update diff --git a/generate.sh b/generate.sh index e3e07f9..92e8299 100755 --- a/generate.sh +++ b/generate.sh @@ -17,7 +17,7 @@ bundle exec rails generate delayed_job:active_record # The whole shebang, models, views, and controllers bundle exec rails generate scaffold server default_user_permissions:integer -bundle exec rails generate scaffold match status:integer tournament:references name:string winner:references remote_id:string +bundle exec rails generate scaffold match status:integer tournament:references name:string winner:references remote_id:string submitted_peer_evaluations:integer bundle exec rails generate scaffold team match:references bundle exec rails generate scaffold alert author:references message:text bundle exec rails generate scaffold pm author:references recipient:references message:text -- cgit v1.2.3-54-g00ecf