fix "Download Submissions" in gradebook in concluded courses

test plan:
* create a course with file upload submissions
* upload a student submission
* soft or hard-conclude the course
* the "Download Submissions" dropdown
 under the assignment in the gradebook
 should work as before

* should also be able to download from the
 assignment page

closes #CNVS-11107

Change-Id: Ie187733bd1f638945e0a4d268db0d7cad53b99ba
Reviewed-on: https://gerrit.instructure.com/65330
Tested-by: Jenkins
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Clare Strong <clare@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
This commit is contained in:
James Williams 2015-10-19 08:26:22 -06:00
parent 28a13a706b
commit 4f8c00c73d
7 changed files with 38 additions and 35 deletions

View File

@ -54,7 +54,7 @@ define [
setDefaultGrade: @allSubmissionsLoaded
curveGrades: @allSubmissionsLoaded && @assignment.grading_type != 'pass_fail' && @assignment.points_possible
downloadSubmissions: "#{@assignment.submission_types}".match(/(online_upload|online_text_entry|online_url)/) && @assignment.has_submitted_submissions
reuploadSubmissions: @assignment.submissions_downloads > 0
reuploadSubmissions: @gradebook.options.gradebook_is_editable && @assignment.submissions_downloads > 0
}
)
.popup('open')

View File

@ -140,8 +140,10 @@ class AssignmentsController < ApplicationController
:EXTERNAL_TOOLS => external_tools_json(@external_tools, @context, @current_user, session)
})
if @assignment.grants_right?(@current_user, session, :grade)
visible_student_ids = @context.enrollments_visible_to(@current_user).pluck(:user_id)
@can_view_grades = @context.grants_right?(@current_user, session, :view_all_grades)
@can_grade = @assignment.grants_right?(@current_user, session, :grade)
if @can_view_grades || @can_grade
visible_student_ids = @context.enrollments_visible_to(@current_user, :include_priors => true).pluck(:user_id)
@current_student_submissions = @assignment.submissions.where("submissions.submission_type IS NOT NULL").where(:user_id => visible_student_ids).to_a
end

View File

@ -93,13 +93,12 @@ class SubmissionsController < ApplicationController
def index
@assignment = @context.assignments.active.find(params[:assignment_id])
if authorized_action(@assignment, @current_user, :grade)
if params[:zip]
generate_submission_zip(@assignment, @context)
else
respond_to do |format|
format.html { redirect_to named_context_url(@context, :context_assignment_url, @assignment.id) }
end
return render_unauthorized_action unless @assignment.user_can_read_grades?(@current_user, session)
if params[:zip]
generate_submission_zip(@assignment, @context)
else
respond_to do |format|
format.html { redirect_to named_context_url(@context, :context_assignment_url, @assignment.id) }
end
end
end

View File

@ -36,7 +36,7 @@ define([
dropdownOptions.push(downloadSubmissionsOption);
}
if (assignment.submissions_downloads > 0 ) {
if (GradebookConstants.gradebook_is_editable &&assignment.submissions_downloads > 0 ) {
reuploadSubmissionsOption = { title: I18n.t('Re-Upload Submissions'), action: 'reuploadSubmissions' };
dropdownOptions.push(reuploadSubmissionsOption);
}

View File

@ -1,5 +1,5 @@
<div id="sidebar_content">
<% if can_do(@assignment, @current_user, :grade) %>
<% if @can_view_grades || @can_grade %>
<%= render :partial => "grade_assignment" %>
<% end %>

View File

@ -1,6 +1,6 @@
<ul class='page-action-list'>
<h2><%= t 'titles.related_items', "Related Items" %></h2>
<% if @context.allows_speed_grader? %>
<% if @can_grade && @context.allows_speed_grader? %>
<li id="assignment-speedgrader-link"
<% if @assignment.unpublished? %>
class="hidden"
@ -24,32 +24,34 @@
class="download_submissions_link icon-download">
<%= t 'links.download_submissions', "Download Submissions" %>
</a>
<a href="#" class="upload_submissions_link icon-upload" style="<%= hidden unless @assignment.submissions_downloaded? %>">
<%= t 'links.reupload_submissions', "Re-Upload Submissions" %>
</a>
<%= form_tag context_url(@context, :submissions_upload_context_gradebook_url, @assignment.id), {:id => "re_upload_submissions_form", :multipart => true, :style => "margin-top: 10px; display: none;"} do %>
<div style="font-size: 0.8em;">
<%= mt :reupload_instructions, <<-EOT
If you made changes to the student submission files you downloaded
before, just zip them back up and upload the zip with the form below.
Students will see the modified files in their comments for the submission.
<% if @can_grade %>
<a href="#" class="upload_submissions_link icon-upload" style="<%= hidden unless @assignment.submissions_downloaded? %>">
<%= t 'links.reupload_submissions', "Re-Upload Submissions" %>
</a>
<%= form_tag context_url(@context, :submissions_upload_context_gradebook_url, @assignment.id), {:id => "re_upload_submissions_form", :multipart => true, :style => "margin-top: 10px; display: none;"} do %>
<div style="font-size: 0.8em;">
<%= mt :reupload_instructions, <<-EOT
If you made changes to the student submission files you downloaded
before, just zip them back up and upload the zip with the form below.
Students will see the modified files in their comments for the submission.
*Make sure you don't change the names of the submission files so we can recognize them.*
EOT
%>
</div>
<div>
<input type="file" name="submissions_zip"/>
<div class="button-container">
<button type="submit" class="btn"><%= t 'buttons.upload_files', "Upload Files" %></button>
*Make sure you don't change the names of the submission files so we can recognize them.*
EOT
%>
</div>
</div>
<div>
<input type="file" name="submissions_zip"/>
<div class="button-container">
<button type="submit" class="btn"><%= t 'buttons.upload_files', "Upload Files" %></button>
</div>
</div>
<% end %>
<% end %>
</li>
<% end %>
<% end %>
<% if @assignment.has_peer_reviews? %>
<% if @can_grade && @assignment.has_peer_reviews? %>
<li>
<a href="<%= context_url(@context, :context_assignment_peer_reviews_url, @assignment.id) %>"
class="assignment_peer_reviews_link icon-peer-review">
@ -59,7 +61,7 @@ Students will see the modified files in their comments for the submission.
<% end %>
</ul>
<% if @current_student_submissions.present? %>
<% if @can_grade && @current_student_submissions.present? %>
<% subs = @current_student_submissions %>
<div style="margin-top: 10px;">
@ -76,4 +78,4 @@ Students will see the modified files in their comments for the submission.
<% end %>
</div>
<% end %>
<% end %>

View File

@ -28,7 +28,7 @@ define [
module 'AssignmentHeaderDropdownOptions -- speedgrader enabled',
setup: ->
fakeENV.setup({ GRADEBOOK_OPTIONS: { context_id: '1', speed_grader_enabled: true } })
fakeENV.setup({ GRADEBOOK_OPTIONS: { context_id: '1', speed_grader_enabled: true, gradebook_is_editable: true } })
GradebookConstants.refresh()
teardown: ->
React.unmountComponentAtNode wrapper