Skip to content

Commit

Permalink
Optimize view exercise page
Browse files Browse the repository at this point in the history
  • Loading branch information
nygrenh committed Mar 28, 2024
1 parent 8d4e216 commit deb0140
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
1 change: 0 additions & 1 deletion app/controllers/exercises_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ def show

@submissions = @submissions.where(user_id: current_user.id) unless can? :teach, @course
@submissions = @submissions.includes(:awarded_points).includes(:user).includes(:course)
@submission_count = @submissions.count
@submissions = @submissions.limit(50) unless !!params[:view_all]
else
@submissions = nil
Expand Down
4 changes: 2 additions & 2 deletions app/views/exercises/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,8 @@
<div class="col-md-12">
<h2>Submissions</h2>
<% if !@submissions.empty? %>
<% if @submissions.size < @submission_count %>
<p>Showing <%= @submissions.size%> of <%= @submission_count %> submissions. <%= link_to "View all submissions", exercise_path(@exercise, view_all: 1) %></p>
<% if @submissions.size == 50 %>
<p>Showing only 50 submissions. <%= link_to "View all submissions", exercise_path(@exercise, view_all: 1) %></p>
<% end %>
<%= show_submission_list(@submissions, :show_exercise_column => false, :show_awarded_points => true) %>
<% else %>
Expand Down

0 comments on commit deb0140

Please sign in to comment.