summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorAndrewMurrell <amurrel@purdue.edu>2014-04-07 13:20:55 -0400
committerAndrewMurrell <amurrel@purdue.edu>2014-04-07 13:20:55 -0400
commit3b282494027e4ed8f63c46ba530727c5378064fb (patch)
tree30d06990237189574c3009627302a7fb5878481e /app
parentc10c4a27277a0335cd51f85708d12e8c81f7bc9d (diff)
Added sprint 3 documents.
Diffstat (limited to 'app')
-rw-r--r--app/views/matches/show.html.erb62
1 files changed, 18 insertions, 44 deletions
diff --git a/app/views/matches/show.html.erb b/app/views/matches/show.html.erb
index 1f14e05..ba1ff9b 100644
--- a/app/views/matches/show.html.erb
+++ b/app/views/matches/show.html.erb
@@ -1,29 +1,16 @@
-<div class="row" id="match-stats">
- <div class="col-md-4 col-sm-3 ">
- <strong>Status:</strong>
- <% case @match.status %>
- <% when 0 %>
- Match Not Started
- <% when 1 %>
- Match in Progress
- <% when 2 %>
- Peer Review in Progress
- <% when 3 %>
- Finished
- <% end %>
- <span id="current-id"> <%= @match.status %></span>
-
- </div>
- <div class="col-md-4 col-sm-3">
- <strong>Tournament:</strong>
- <%= @match.tournament.name %>
- </div>
+<p>
+ <strong>Status:</strong>
+ <%= @match.status %>
+</p>
+<p>
+ <strong>Tournament:</strong>
+ <%= @match.tournament.id %>
+</p>
- <div class="col-md-4 col-sm-3">
- <strong>Name:</strong>
- <%= @match.name %>
- </div>
-</div>
+<p>
+ <strong>Name:</strong>
+ <%= @match.name %>
+</p>
<!--
Match Status 0 => Created, waiting to start
Match Status 1 => Match is running, waiting to finish
@@ -58,8 +45,8 @@
</div>
<% unless @match.winner.nil? %>
- <p id="match-winner">
- <strong>Winning Team:</strong>
+ <p>
+ <strong>Winner:</strong>
<%= @match.winner.users.collect{|u| u.user_name}.join(", ") %>
</p>
<% end %>
@@ -83,7 +70,9 @@
<fieldset><legend>Team <%= team.id.to_s %></legend>
<% team.users.collect{|u| u.user_name}.each do |k| %><label>
Score for <%= k %><br>
- <%= text_field_tag("scores[#{k}]", 0, size: 3) %>
+ <% @player_score = 0 %>
+ <% current_user.scores.find_by_match(@match).each{ |s| @player_score+=s.value } %>
+ <%= text_field_tag("scores[#{k}]", @player_score, size: 3) %>
</label><% end %>
</fieldset>
<% end %>
@@ -100,7 +89,7 @@
<% @match.teams.each do |team| %>
<% if team.users.include?(current_user) %>
<ol id="boxes" class="sortable">
- <% team.users.reject { |u| (u.user_name == @current_user.user_name) }.collect {|u| u.user_name }.each do |k| %>
+ <% team.users.reject{ |u| (u.user_name == @current_user.user_name) }.collect {|u| u.user_name }.each do |k| %>
<li><%= k%>
<br>
<% if (@tournament.game_id == 1) %>
@@ -140,19 +129,4 @@ function score_peers() {
$('review_action').value += $('ol#boxes:eq(' + i + ')').text() + comma;
}
}
-
-
-function donehandle( match ) {
- if ( console && console.log ) {
- }
-
- //if match has moved on in status, reload the page.
- if (parseInt($("#current-id").text()) != match["status"])
- window.location.reload(true);
-
- setTimeout(function(){$.ajax({url: "<%= request.original_url %>.json"}).done(donehandle)}, 2000);
-}
-
-$.ajax({url: "<%= request.original_url %>.json"})
- .done(donehandle);
</script>