<%# Hide error message (if any) %>
document.getElementById('criterion_incomplete_error').addClass('hidden');
<% if @result.marking_state == Result::MARKING_STATES[:complete] %>
  var revert = "<%= t('marker.revert_to_incomplete') %>";
  document.getElementById('toggle_marking_state').firstChild.value = revert;
  document.getElementById('toggle_released').firstChild.disabled = false;
<% else %>
  var set = "<%= t('marker.set_to_complete') %>";
  document.getElementById('toggle_marking_state').firstChild.value = set;
  document.getElementById('toggle_released').firstChild.disabled = true;
<% end %>

<%
  @assignment = @result.submission.assignment
  if @current_user.admin?
    num_marked = @assignment.get_num_marked
    num_assigned = @assignment.get_num_assigned
  else
    num_marked = @assignment.get_num_marked(@current_user.id)
    num_assigned = @assignment.get_num_assigned(@current_user.id)
  end
%>

update_bar(<%= num_marked %>, <%= num_assigned %>);

<%# Hide error message (if any) %>
document.getElementById('criterion_incomplete_error').addClass('hidden');
<% if @result.marking_state == Result::MARKING_STATES[:complete] %>
  var revert = "<%= t('marker.revert_to_incomplete') %>";
  document.getElementById('toggle_marking_state').firstChild.value = revert;
  if (document.getElementById('toggle_released')) {
    document.getElementById('toggle_released').firstChild.disabled = false;
  }
<% else %>
  var set = "<%= t('marker.set_to_complete') %>";
  document.getElementById('toggle_marking_state').firstChild.value = set;
  if (document.getElementById('toggle_released')) {
    document.getElementById('toggle_released').firstChild.disabled = true;
  }
<% end %>

<%
  @assignment = @result.submission.assignment
  if @current_user.admin?
    num_marked = @assignment.get_num_marked
    num_assigned = @assignment.get_num_assigned
  else
    num_marked = @assignment.get_num_marked(@current_user.id)
    num_assigned = @assignment.get_num_assigned(@current_user.id)
  end
%>

update_bar(<%= num_marked %>, <%= num_assigned %>);

Fix bug with update_bar for TAs
Fix bug with update_bar for TAs
