Skip to content

Commit cfdbab4

Browse files
committed
Small nits
1 parent 806cc0f commit cfdbab4

File tree

2 files changed

+23
-21
lines changed

2 files changed

+23
-21
lines changed

app/assets/javascripts/manage_submissions.js

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,9 @@ $(document).ready(function() {
108108
tweaks = [];
109109

110110
const submissions_body = data.submissions.map((submission) => {
111-
const Tweak = new AutolabComponent(`tweak-value-${submission.id}`, {amount: null});
111+
const Tweak = new AutolabComponent(`tweak-value-${submission.id}`, { amount: null });
112112
Tweak.template = function () {
113-
return EditTweakButton(this.state.amount);
113+
return EditTweakButton( this.state.amount );
114114
}
115115
tweaks.push({tweak: Tweak, submission_id: submission.id, submission});
116116

@@ -121,21 +121,21 @@ $(document).ready(function() {
121121

122122
// Convert to human readable date with timezone
123123
const human_readable_created_at =
124-
moment(submission.created_at).format('MMM Do YY, h:mma z UTC Z');
124+
moment(submission.created_at).format('MMM Do YY, h:mma z UTC Z');
125125

126126
const view_button = submission.filename ?
127-
`<div class="submissions-center-icons">
127+
`<div class="submissions-center-icons">
128128
<a href="submissions/${submission.id}/view"
129129
title="View the file for this submission"
130130
class="btn small">
131131
<i class='material-icons'>zoom_in</i>
132132
</a>
133133
<p>View Source</p>
134134
</div>`
135-
: "None";
135+
: "None";
136136

137137
const download_button =
138-
/text/.test(submission.detected_mime_type) ?
138+
/text/.test(submission.detected_mime_type) ?
139139
`<div class="submissions-center-icons">
140140
<a href="submissions/${submission.id}/download?forceMime=text/plain"
141141
title="Download as text/plain"
@@ -163,15 +163,16 @@ $(document).ready(function() {
163163
<td class="submissions-td">
164164
${submission.total}
165165
</td>
166-
${submission.problems.map((problem) =>
167-
`<td class="submissions-td">
166+
${submission.problems.
167+
map((problem) =>
168+
`<td class="submissions-td">
168169
${data.scores[submission.id]?.[problem.id]?.['score'] !== undefined
169-
? `<a href="viewFeedback?submission_id=${submission.id}&feedback=${problem.id}">
170+
? `<a href="viewFeedback?submission_id=${submission.id}&feedback=${problem.id}">
170171
${data.scores[submission.id][problem.id]['score'].toFixed(1)}
171172
</a>`
172-
: "-"}
173+
: "-"}
173174
</td>`
174-
).join('')}
175+
).join('')}
175176
<td class="submissions-td">
176177
${submission.late_penalty}
177178
</td>
@@ -187,7 +188,7 @@ $(document).ready(function() {
187188
}).join('');
188189

189190
const submissions_table =
190-
` <p>Click on non-autograded problem scores to edit or leave a comment. </p>
191+
` <p>Click on non-autograded problem scores to edit or leave a comment. </p>
191192
<table class="prettyBorder" id="score-details-table">
192193
<thead>
193194
<tr>
@@ -213,10 +214,10 @@ $(document).ready(function() {
213214
"order": [[0, "desc"]],
214215
"paging": false,
215216
"info": false,
216-
"searching": false,
217-
});
217+
"searching": false,});
218218

219219
return data.submissions;
220+
220221
}).then((submissions) => {
221222
$('.tweak-button').on('click', selectTweak(submissions));
222223
}).catch((err) => {
@@ -345,17 +346,21 @@ $(document).ready(function() {
345346
var downloadHTML = $('#download-batch-html').html();
346347
var excuseHTML = $('#excuse-batch-html').html();
347348
$('div.selected-buttons').html(`<div id='selected-buttons'>${regradeHTML}${deleteHTML}${downloadHTML}${excuseHTML}</div>`);
349+
350+
// add ids to each selected button
348351
$('#selected-buttons > a').each(function () {
349352
let idText = this.title.split(' ')[0].toLowerCase() + '-selected';
350353
this.setAttribute('id', idText);
351354
});
355+
352356
if (!is_autograded) {
353357
$('#regrade-selected').hide();
354358
$('#regrade-all-html').hide();
355359
}
356360

361+
// base URLs for selected buttons
357362
var baseURLs = {};
358-
buttonIDs.forEach(function (id) {
363+
buttonIDs.forEach(function(id) {
359364
baseURLs[id] = $(id).prop('href');
360365
});
361366

@@ -418,6 +423,7 @@ $(document).ready(function() {
418423
}
419424
});
420425
});
426+
421427
function changeButtonStates(state) {
422428
buttonIDs.forEach((id) => {
423429
const button = $(id);
@@ -445,7 +451,7 @@ $(document).ready(function() {
445451
return;
446452
}
447453
const endpoint = manage_submissions_endpoints[id.replace("#", "")];
448-
const requestData = {submission_ids: selectedSubmissions};
454+
const requestData = { submission_ids: selectedSubmissions };
449455
if (id === "#delete-selected") {
450456
if (!confirm("Deleting will delete all checked submissions and cannot be undone. Are you sure you want to delete these submissions?")) {
451457
return;
@@ -499,8 +505,6 @@ $(document).ready(function() {
499505

500506
// SELECTING STUDENT CHECKBOXES
501507
function toggleRow(submissionId, forceSelect = null) {
502-
console.log('toggleRow called:', submissionId, 'forceSelect:', forceSelect);
503-
console.log('selectedSubmissions before:', [...selectedSubmissions]);
504508
var selectedCid = submissions_to_cud[submissionId];
505509
const isSelected = selectedSubmissions.includes(submissionId);
506510
const shouldSelect = forceSelect !== null ? forceSelect : !isSelected;
@@ -533,8 +537,6 @@ $(document).ready(function() {
533537
$('#cbox-select-all').prop('checked', numericSelectedSubmissions.length === $('#submissions tbody .cbox').length);
534538
updateSelectedCount(numericSelectedSubmissions);
535539
changeButtonStates(disableButtons);
536-
console.log('selectedSubmissions after:', [...selectedSubmissions]);
537-
console.log('Checkbox state:', $('#cbox-' + submissionId).prop('checked'));
538540
}
539541

540542
$('#submissions').on('click', '.exclude-click i', function (e) {

app/views/submissions/index.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
new_course_assessment_submission_path(@course, @assessment),
5858
{ title: "Create a new submission for a student, with an option to submit a handin file on their behalf",
5959
class: "btn submissions-main" } %>
60-
</div>
60+
</div>
6161

6262
<div class="buttons-spacing">
6363
<%= link_to "<i class='material-icons left submissions-icons'>file_download</i>Download Final Submissions".html_safe,

0 commit comments

Comments
 (0)