Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Manage Submissions] Score popup modal styling + fixes #1952

Draft
wants to merge 4 commits into
base: feature/new-manage-submissions
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 39 additions & 10 deletions app/assets/javascripts/manage_submissions.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,20 @@ $(document).ready(function () {

// Fetch data and render it in the modal
get_score_details(course_user_datum_id).then((data) => {
const sorting_icons =
Copy link
Member

@damianhxy damianhxy Oct 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Screenshot 2023-10-06 at 02 29 08

Note that once datatables-rows is correctly included, there are existing sorting icons, so there is actually no need to implement your own

` <i class="material-icons tiny sort-icon sort-icon__both" aria-hidden="true">swap_vert</i>
<i class="material-icons tiny sort-icon sort-icon__up" aria-hidden="true">arrow_upward</i>
<i class="material-icons tiny sort-icon sort-icon__down" aria-hidden="true">arrow_downward</i>`;

const problem_headers = data.submissions[0].problems.map((problem) => {
const max_score = problem.max_score;
const autograded = problem.grader_id < 0 ? " (Autograded)" : "";
return `<th class="submission-th">
${problem.name}
<br>
<i> ${max_score} ${autograded} </i>
const autograded = data.autograded ? " (Autograded)" : "";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Screenshot 2023-10-06 at 02 11 21

Seems to erroneously mark non-autograded problems as autograded

Copy link
Member

@damianhxy damianhxy Oct 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that autograded is set via autograded = @assessment.has_autograder?, so it's not a good way to check if a problem is autograded

return `<th class="submission-th submissions-problem-bg">
<div class="sorting-th">
${problem.name}
${sorting_icons}
</div>
<span class="score-styling"> ${max_score} ${autograded} </span>
</th>`;
}).join('');

Expand Down Expand Up @@ -109,7 +115,10 @@ $(document).ready(function () {
</td>
${submission.problems.
map((problem) =>
`<td class="submissions-td">${data.scores[submission.id][problem.id]?.['score']}</td>`
data.scores[submission.id] ?
Copy link
Member

@damianhxy damianhxy Oct 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You might want to strengthen the check to data.scores[submission.id]?.[problem.id]. Otherwise, submissions with no score for a particular problem would still show undefined (assuming you make the dash change below).

This happens e.g. for manually graded problems for which no annotations have been created yet.

`<td class="submissions-td submissions-problem-bg">${data.scores[submission.id][problem.id]?.['score']}</td>`
:
`<td class="submissions-td submissions-problem-bg">undefined</td>`
Copy link
Member

@damianhxy damianhxy Oct 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps you could use a dash instead of undefined?

).join('')}
<td class="submissions-td">
${submission.late_penalty}
Expand All @@ -131,11 +140,31 @@ $(document).ready(function () {
<table class="prettyBorder" id="score-details-table">
<thead>
<tr>
<th class="submission-th">Version No.</th>
<th class="submission-th">Submission Date</th>
<th class="submission-th">Final Score</th>
<th class="submission-th">
<div class="sorting-th">
Version No.
${sorting_icons}
</div>
</th>
<th class="submission-th">
<div class="sorting-th">
Submission Date
${sorting_icons}
</div>
</th>
<th class="submission-th">
<div class="sorting-th">
Final Score
${sorting_icons}
</div>
</th>
${problem_headers}
<th class="submission-th">Late Penalty</th>
<th class="submission-th">
<div class="sorting-th">
Late Penalty
${sorting_icons}
</div>
</th>
<th class="submission-th">Tweak</th>
<th class="submission-th">Actions</th>
</tr>
Expand Down
50 changes: 44 additions & 6 deletions app/assets/stylesheets/manage_submissions.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
.modal-header {
float: right;
margin-bottom: 0;
padding-bottom: 0;
/* Score Popup */

#modal-close {
font-size: 2rem;
position: absolute;
top: -35%;
right: 0;
padding: 0;
}

.score-details {
Expand All @@ -13,6 +17,40 @@
height: auto;
}

.submissions-td {
padding-left: 0.6rem !important;
/* Table Header */

#score-details-header {
position: relative;
margin-top: 0;
}

.score-styling {
font-weight: normal;
font-style: italic;
text-transform: none;
}

.sorting-th {
display: flex;
align-items: center;
}

/* Table Styling */

.submissions-problem-bg {
background-color: #F2F2F2 !important;
}

table.prettyBorder tr:hover {
background-color: white;
}

/* Icons */

.material-icons {
margin-left: 3px;
}

.i-no-margin {
margin-left: 0;
}
7 changes: 5 additions & 2 deletions app/assets/stylesheets/style.css.scss
Original file line number Diff line number Diff line change
Expand Up @@ -791,7 +791,6 @@ table.prettyBorder {
p {
margin: 0;
float: left;
padding-right: 3px;
}
}

Expand Down Expand Up @@ -824,7 +823,7 @@ table.prettyBorder {
.submissions-td {
border: none;
border-bottom: 1px solid #ddd;
padding: 5px 0 5px 0;
padding: 5px 0 5px 0.6rem;
}

.submissions-cbox-label {
Expand Down Expand Up @@ -1574,6 +1573,10 @@ table.sub td, th {
margin-left: 3px;
}

i.left {
margin-right: 10px;
}

.submissions-score-align {
display: flex;
align-items: center;
Expand Down
14 changes: 6 additions & 8 deletions app/views/submissions/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@
<td class="submissions-td" style="<%= ignored_submission_style submission %>">
<% if submission.filename then %>
<div class="submissions-center-icons">
<%= link_to "<i class='material-icons'>zoom_in</i>".html_safe,
<%= link_to "<i class='material-icons i-no-margin'>zoom_in</i>".html_safe,
[:view, @course, @assessment, submission],
{:title=>"View the file for this submission",
:class=>"btn small"} %>
Expand All @@ -143,13 +143,13 @@
:method => :post,
:title=>"Rerun the autograder on this submission",
:class=>"btn small" do %>
<i class='material-icons'>autorenew</i>
<i class='material-icons i-no-margin'>autorenew</i>
<% end %>
<p>Regrade</p>
</div>
<% end %>
<div class="submissions-center-icons">
<%= link_to "<i class='material-icons'>delete_outline</i>".html_safe,
<%= link_to "<i class='material-icons i-no-margin'>delete_outline</i>".html_safe,
destroyConfirm_course_assessment_submission_path(@course, @assessment, submission),
{:title=>"Destroy this submission forever",
:class=>"btn small"} %>
Expand All @@ -162,12 +162,10 @@
</table>

<div id="score-details-modal" class="modal">
<div class="modal-header">
<a href="#!" class="modal-close btn-flat"><i class="material-icons">close</i>
</a>
</div>
<div class="modal-content">
<h3>Score Details for <span id="score-details-email"></span></h3>
<h3 id="score-details-header">Score Details for <span id="score-details-email"></span>
<a href="#!" class="modal-close btn-flat" id="modal-close"><i class="material-icons">close</i></a>
</h3>
<hr>
<div id="score-details-content"></div>
</div>
Expand Down