Skip to content

Commit

Permalink
Patches for release v2.0.3 (#806)
Browse files Browse the repository at this point in the history
* Fix Manage Submissions Page functionality (#805)

* use $? instead of $CHILD_STATUS in Moss (#804)
  • Loading branch information
Aatish Nayak authored Mar 7, 2017
1 parent cd65795 commit 614f928
Show file tree
Hide file tree
Showing 5 changed files with 80 additions and 67 deletions.
13 changes: 3 additions & 10 deletions app/assets/javascripts/manage_submissions.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,8 @@ jQuery(function($) {
'sPaginationType': 'full_numbers',
'iDisplayLength': 100,
'oLanguage': {
'sLengthMenu': 'Display <select>' +
'<option value="10">10</option>' +
'<option value="20">20</option>' +
'<option value="50">50</option>' +
'<option value="100">100</option>' +
'<option value="-1">All</option>' +
'</select> records · ' +
'<div class="row"><input type="checkbox" id="only-latest">' +
'<label for="only-latest">Show only latest</label></div>'
'sLengthMenu':'<input type="checkbox" id="only-latest">' +
'<label for="only-latest">Show only latest</label>'
},
"columnDefs": [{
"targets": [7],
Expand All @@ -60,7 +53,7 @@ jQuery(function($) {
});

var ids = [];
$("input.checkbox:checked").each(function() {
$("input[type='checkbox']:checked").each(function() {
ids.push($(this).val());
});

Expand Down
2 changes: 1 addition & 1 deletion app/controllers/courses_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ def runMoss
`~/Autolab/script/cleanMoss #{tmp_dir}`
# Now run the Moss command
@mossCmdString = @mossCmd.join(" ")
@mossExit = $CHILD_STATUS
@mossExit = $?.exitstatus
@mossOutput = `#{@mossCmdString} 2>&1`

# Clean up after ourselves (droh: leave for dsebugging)
Expand Down
4 changes: 2 additions & 2 deletions app/views/submissions/edit.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@
</tr>
<tr>
<th>Notes:</th>
<td><%= f.text_area :notes, :rows=>5 %></td>
<td><%= f.text_area :notes, :rows=>5, class: 'materialize-textarea', placeholder: "Notes on submission"%></td>
</tr>
<tr>
<th>Tweak:</th>
<td>
<%= f.fields_for :tweak, @submission.tweak do |t| %>
<%= t.text_field :value %>
<%= t.text_field :value, placeholder: "Number of points or percentage" %>
<%= t.select :kind, options_for_select({"points" => "points", "%" => "percent"}, :selected => (@submission.tweak ? @submission.tweak.kind : "points")) %>
<% end %>
</td>
Expand Down
124 changes: 72 additions & 52 deletions app/views/submissions/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,58 +2,74 @@

<% content_for :stylesheets do %>
<%= stylesheet_link_tag "datatable.adapter" %>

<style>
table [type="checkbox"] + label {
width: 18px;
padding: 0;
}

#floater {
z-index: 5;
}
</style>
<% end %>

<% content_for :javascripts do %>
<%= external_javascript_include_tag "lodash", "3.3.1" %>
<%= javascript_include_tag "sorttable" %>
<%= external_javascript_include_tag "jquery.dataTables", "1.10.5" %>
<%= external_javascript_include_tag "jquery.dataTables", "1.10.9" %>

<%= javascript_include_tag "table_floating_header" %>
<%= javascript_include_tag "manage_submissions" %>

<% end %>

<h3>Manage Submissions</h3>
<hr>
<p>
<%= link_to "Create New Submission", new_course_assessment_submission_path(@course, @assessment),
{:title=>"Create a new submission for a student, with an option to submit a handin file on their behalf",
:class=>"btn"} %>
<%= link_to "Download All Submissions",
downloadAll_course_assessment_submissions_path(@course, @assessment),
{:title=>"Down all submissions from each student",
:class=>"btn"} %>
<%= link_to "Download Final Submissions",
downloadAll_course_assessment_submissions_path(@course, @assessment, final: true),
{:title=>"Download the most recent submission from each student",
:class=>"btn"} %>
<%= link_to "Missing Submissions",
missing_course_assessment_submissions_path(@course, @assessment),
{:title=>"List the students who have not submitted anything. You'll be given the option to create new submissions for the missing students",
:class=>"btn"} %>
</p>
<p>
<% if @autograded then %>
<%= link_to "Regrade All",
[:regradeAll, @course, @assessment],
{ method: :post,
:title=>"Regrade the most recent submission from each student",
:confirm=>"Are you sure you want to do this? It will regrade the most recent submission from each student, which might take a while.",
:class=>"btn"} %>

<%= link_to "Regrade 0 Submissions",
[:regradeBatch, @course, @assessment],
{ method: :post,
:title=>"Regrade the most recent submission from each student",
:class=>"btn",
:id => "batch-regrade",
:style => "display:none;"} %>
<p>
<%= link_to "Create New Submission".html_safe, new_course_assessment_submission_path(@course, @assessment),
{:title=>"Create a new submission for a student, with an option to submit a handin file on their behalf",
:class=>""} %>
|
<%= link_to "Download All Submissions".html_safe,
downloadAll_course_assessment_submissions_path(@course, @assessment),
{:title=>"Down all submissions from each student",
:class=>""} %>
|
<%= link_to "Download Final Submissions".html_safe,
downloadAll_course_assessment_submissions_path(@course, @assessment, final: true),
{:title=>"Download the most recent submission from each student",
:class=>""} %>
|
<%= link_to "Missing Submissions".html_safe,
missing_course_assessment_submissions_path(@course, @assessment),
{:title=>"List the students who have not submitted anything. You'll be given the option to create new submissions for the missing students",
:class=>""} %>

<% end %>
</p>
<hr>
<div class="row">
<% if @autograded then %>
<div class="col s3">
<%= link_to "Regrade All",
[:regradeAll, @course, @assessment],
{ method: :post,
:title=>"Regrade the most recent submission from each student",
:confirm=>"Are you sure you want to do this? It will regrade the most recent submission from each student, which might take a while.",
:class=>"btn"} %>
</div>
<div class="col s3 offset-s6">

<p>
<%= link_to "Regrade 0",
[:regradeBatch, @course, @assessment],
{ method: :post,
:title=>"Regrade the most recent submission from each student",
:class=>"btn float-right",
:id => "batch-regrade",
:style => "display:none;"} %>
</div>
<% end %>
</div>
<table class="prettyBorder" id="submissions">
<% headers = ["Submitted By", "Version", "Submission Date (YYYY-MM-DD)", "File", "IP Address", "Actions", "isLatest"] %>
<% if @assessment.has_custom_form then %>
Expand All @@ -66,7 +82,7 @@
<% end %>
<thead>
<tr>
<th><input type="checkbox" id="selectall"/></th>
<th></th>
<% for header in headers %>
<th><%= header %></th>
<% end %>
Expand All @@ -75,7 +91,10 @@
<tbody>
<% for submission in @submissions %>
<tr id="row-<%= submission.id %>" class="submission-row">
<td><input class="cbox" type="checkbox" id="cbox-<%= submission.id %>"></td>
<td>
<input class="cbox" type="checkbox" id="cbox-<%= submission.id %>">
<label for="cbox-<%= submission.id %>"></label>
</td>
<td><%= "#{submission.course_user_datum.last_name}, #{submission.course_user_datum.first_name}" %>
<%= link_to submission.course_user_datum.email,
history_course_assessment_path(@course, @assessment, cud_id: submission.course_user_datum_id, partial: true),
Expand All @@ -97,19 +116,20 @@
<td>
<%= submission.submitter_ip %>
</td>
<td><% if @autograded and submission.version > 0 then %>
<%= link_to "Regrade",
[:regrade, @course, @assessment, submission_id: submission.id],
{ method: :post,
:title=>"Rerun the autograder on this submission",
:class=>"waves-effect waves-light btn small regrade-override"} %>
<% end %>
<%= link_to "Edit", [:edit, @course, @assessment, submission],
{:title=>"Edit the grading properties of this submission",
:class=>"btn small"} %>
<%= link_to "Destroy", destroyConfirm_course_assessment_submission_path(@course, @assessment, submission),
{:title=>"Destroy this submission forever",
:class=>"btn small"} %>
<td class="exclude-click">
<% if @autograded and submission.version > 0 then %>
<%= link_to "<i class='material-icons'>autorenew</i>".html_safe,
[:regrade, @course, @assessment, submission_id: submission.id],
{ method: :post,
:title=>"Rerun the autograder on this submission",
:class=>"btn small regrade-override"} %>
<% end %>
<%= link_to "<i class='material-icons'>edit</i>".html_safe, [:edit, @course, @assessment, submission],
{:title=>"Edit the grading properties of this submission",
:class=>"btn small"} %>
<%= link_to "<i class='material-icons'>delete</i>".html_safe, destroyConfirm_course_assessment_submission_path(@course, @assessment, submission),
{:title=>"Destroy this submission forever",
:class=>"btn small"} %>
</td>
<td><%= submission.latest? %>
</td>
Expand Down
4 changes: 2 additions & 2 deletions app/views/submissions/new.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,13 @@
<th>File:</th><td><%= f.file_field :file %></td>
</tr>
<tr>
<th>Notes:</th><td><%= f.text_area :notes %></td>
<th>Notes:</th><td><%= f.text_area :notes, class: 'materialize-textarea', placeholder: "Notes on submission"%></td>
</tr>
<tr>
<th>Tweak:</th>
<td>
<%= f.fields_for :tweak, @submission.tweak do |t| %>
<%= t.text_field :value %>
<%= t.text_field :value, placeholder: "Number of points or percentage" %>
<%= t.select :kind, options_for_select({"points" => "points", "%" => "percent"}, :selected => (@submission.tweak ? @submission.tweak.kind : "points")) %>
<% end %>
</td>
Expand Down

0 comments on commit 614f928

Please sign in to comment.