groups submission comments use radio buttons

closes ADMIN-657
part of ADMIN-578

test plan:
* as a student, start an online submission for an individually graded
  group assignment
* you should see two radio buttons to send the comment to just the
  instructor or the whole group
* you should be able to send a private comment to the instructor
* you should be able to send a comment to the whole group

* as a student, start an online submission for an assignment graded as
  a group
* instead of the radio buttons, you should see a message indicating the
  comment will go to the whole group
* the submission comment should go to the whole group

Change-Id: I23f7ac1931812e780064ebf0e1661b29983f7559
Reviewed-on: https://gerrit.instructure.com/137388
Reviewed-by: Mysti Sadler <mysti@instructure.com>
Reviewed-by: Dan Minkevitch <dan@instructure.com>
Product-Review: Christi Wruck
Tested-by: Jenkins
QA-Review: Mysti Sadler <mysti@instructure.com>
This commit is contained in:
Jon Willesen 2018-01-09 15:08:47 -07:00 committed by Jon Willesen
parent 68c1995fc2
commit d65cba05f4
4 changed files with 67 additions and 11 deletions

View File

@ -252,6 +252,7 @@ class SubmissionsController < ApplicationController
:media_comment_type, :media_comment_id, :eula_agreement_timestamp,
:attachment_ids => []
)
submission_params[:group_comment] = value_to_boolean(submission_params[:group_comment])
submission_params[:attachments] = self.class.copy_attachments_to_submissions_folder(@context, params[:submission][:attachments].compact.uniq)
begin

View File

@ -17,12 +17,25 @@
%>
<% if @assignment.has_group_category? && can_do(@assignment.submissions.build(:user => @current_user), @current_user, :make_group_comment) %>
<tr>
<td colspan="2">
<label>
<input type="checkbox" name="submission[group_comment]" />
<%= t('labels.group_comment', 'Send Comment to the Whole Group') %>
</label>
</td>
</tr>
<% end %>
<% if @assignment.grade_as_group? %>
<tr><td colspan="2">
<%= t("All comments are sent to the whole group.") %>
<input type="hidden" name="submission[group_comment]" value="1" />
</td></tr>
<% else %>
<tr><td colspan="2">
<fieldset class="ic-Fieldset ic-Fieldset--radio-checkbox">
<div class="ic-Form-control ic-Form-control--radio">
<div class="ic-Radio">
<input type="radio" name="submission[group_comment]" id="not_submission_group_comment" value="0" checked />
<label for="not_submission_group_comment" class="ic-Label"><%= t("Send comment to instructor only") %></label>
</div>
<div class="ic-Radio">
<input type="radio" name="submission[group_comment]" id="submission_group_comment" value="1" />
<label for="submission_group_comment" class="ic-Label"><%= t("Send comment to the whole group") %></label>
</div>
</div>
</fieldset>
</td></tr>
<% end %>
<% end %>

View File

@ -338,6 +338,24 @@ describe SubmissionsController do
expect(subs.to_a.sum{ |s| s.submission_comments.size }).to eql 1
end
it "should not send a comment to the entire group when false" do
post(
'create',
params: {:course_id => @course.id,
:assignment_id => @assignment.id,
:submission => {
:submission_type => 'online_text_entry',
:body => 'blah',
:comment => "some comment",
:group_comment => '0'
}
})
subs = @assignment.submissions
expect(subs.size).to eq 2
expect(subs.to_a.sum{ |s| s.submission_comments.size }).to eql 1
end
it "should send a comment to the entire group if requested" do
post(
'create',

View File

@ -77,7 +77,7 @@ describe "assignments" do
expect(details).not_to include_text('comment after muting')
end
it "should have group comment checkboxes for group assignments" do
it "should have group comment radio buttons for individually graded group assignments" do
u1 = @user
student_in_course(:course => @course)
u2 = @user
@ -90,7 +90,31 @@ describe "assignments" do
acceptable_tabs = ffj('#submit_online_upload_form,#submit_online_text_entry_form,#submit_online_url_form')
expect(acceptable_tabs.size).to be 3
acceptable_tabs.each { |tabby| expect(ffj('.formtable input[name="submission[group_comment]"]', tabby).size).to be 1 }
acceptable_tabs.each do |tabby|
expect(ffj('.formtable input[type="radio"][name="submission[group_comment]"]', tabby).size).to be 2
end
end
it "should have hidden group comment input for group graded group assignments" do
u1 = @user
student_in_course(:course => @course)
u2 = @user
assignment = @course.assignments.create!(
:title => "some assignment",
:submission_types => "online_url,online_upload,online_text_entry",
:group_category => GroupCategory.create!(:name => "groups", :context => @course),
:grade_group_students_individually => false)
group = assignment.group_category.groups.create!(:name => 'g1', :context => @course)
group.users << u1
group.users << @user
get "/courses/#{@course.id}/assignments/#{assignment.id}"
acceptable_tabs = ffj('#submit_online_upload_form,#submit_online_text_entry_form,#submit_online_url_form')
expect(acceptable_tabs.size).to be 3
acceptable_tabs.each do |tabby|
expect(ffj('.formtable input[type="hidden"][name="submission[group_comment]"]', tabby).size).to be 1
end
end
it "should not show assignments in an unpublished course" do