Skip to content

Commit bdb5682

Browse files
20wildmanjevanyeyeyelykimcheedamianhxydependabot[bot]
authored
Merge master into develop (#1867)
* Fix bug in GitHub api rate limit check (#1821) Fix buggy code * Update docker compose docs (#1823) * Update docker compose docs * Add make warning * Update Export / Import Assessment to support more fields, make importAsmtFromTar and importAssessment more robust (#1822) * - Lint ruby files within spec/ * Add more fields to yml serialization of assessment Add error checking to import assessments (still some errors) * add check to ensure asmt name is valid for import * remove redundant text * create assessment using factory bot, jank test for assessment export * - Add success flash to assessment import - Add a bunch of testcases for bad assessment imports - Modify create_course_with_many_students to handle custom assessment creation, do validation on assessment name * rubocop style * Jump to currently enrolled course (#1812) * Modifications for RuboCop style * Update Manage Submissions test specs to work regardless of jump to course logic --------- Co-authored-by: Damian Ho <[email protected]> * Bump rack from 2.2.6.2 to 2.2.6.3 (#1828) Bumps [rack](https://github.com/rack/rack) from 2.2.6.2 to 2.2.6.3. - [Release notes](https://github.com/rack/rack/releases) - [Changelog](https://github.com/rack/rack/blob/main/CHANGELOG.md) - [Commits](rack/rack@v2.2.6.2...v2.2.6.3) --- updated-dependencies: - dependency-name: rack dependency-type: indirect ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Fix bug where course gets created even if there are errors (#1820) * Add required fields to html for name and instructor email * Destroy course if instructor email is invalid * Change required syntax to favored form * Fix annotated PDF download when global annotation is present (#1833) Skip if coordinate is nil * Course start/end date nil checks (#1834) Add nil check for course start and end dates * Bump rack from 2.2.6.3 to 2.2.6.4 (#1835) Bumps [rack](https://github.com/rack/rack) from 2.2.6.3 to 2.2.6.4. - [Release notes](https://github.com/rack/rack/releases) - [Changelog](https://github.com/rack/rack/blob/main/CHANGELOG.md) - [Commits](rack/rack@v2.2.6.3...v2.2.6.4) --- updated-dependencies: - dependency-name: rack dependency-type: indirect ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Add LTI Configuration to "Manage Autolab" Dropdown, Update docs and gitignore (#1817) * begin updating lti integration documentation and add feature documentation * - update documentation for LTI configuration, linking, installation - add images for LTI linking for documentation - update gitignore, add ignore node_modules (for stylelint) * Revise LTI docs to make instructions more clear --------- Co-authored-by: Victor Huang <[email protected]> * Remove unused "Additional Submission Form" feature code (#1830) * Remove dead code * Update schema version * Fix thead alignment in manage submissions (#1838) * Add sticky to thead css * Remove js file that added a new thead element * Update MacOS install docs to use Homebrew (#1841) Update docs to install homebrew first, then install rbenv and ruby-build - add troubleshooting help for OpenSSL related error * Update Docs to use bash to run init-letsencrypt.sh instead of sh (#1842) Use bash to run init-letsencrypt.sh instead of sh * Allow GitHub submissions to specify commit SHA (#1836) * Add logic to display commit sha and messages * Add logic to pull correct commit * Updating formatting * Remove unnecessary params * Indent update_commits * Clear commit dropdown when switching repository * Use Factory Bot to Replace Autopopulated Database for Testing (#1837) * starter code from pair prog sesh! working factories for now * e * very inconspicuous commit message where assessments controller gets updated with new sets and factory functions e * update users_controller_spec to use new contexts, use shared_examples * update submissions_controller_spec to use new contexts * update admins_controller_spec, attachments_controller_spec (not fully working but going to be deprecated anyways) * - update courses_controller_spec - update schedulers_controller_spec - add nicknames to students in create_course_with_users in order to bypass nickname creation redirect (this fixes attachments controller broken test) * - fix features/manage_submissions_spec.rb to use factory - create controllers_shared_context to facilitate easy use of course and users without having to create a new course / users for every context - begin updating api tests * update controller spec to use new shared context * fix config module not being loaded for assessment * - update factories and create_course to build submissions for students, along with scores - create problems as well - fix more tests * all pre-existing tests now work with FactoryBot - add create_autograded_course to make a "dummy" autograded course (we can't talk with tango but it has all the files / config of an autograded assessment) - create autograder factory - update assessment to by default have group size of 1 (should be individual assessment) * - re-enable autograding_roundtrip_spec - refactor get_course_id_by_uid to get_first_cid_by_uid * Update factory for submissions due to db field being removed, test setup * Remove commented out code * test for create when user is instructor * moved behavior to shared example * annotations specs for expected failures of #create * delete dead code * factory for annotations * Address PR nits --------- Co-authored-by: Joanna Ge <[email protected]> Co-authored-by: Joey Wildman <[email protected]> * Grade Export: Move total column to be after email (#1829) * Move total to after email * Fix typo on bulkGrade page * Add warning to documentation about RAM requirements (#1847) * Update documentation * Add warning to osx and ubuntu pages * Shift admonition to overview page * Avoid rounding final score during bulk grade export (#1860) Avoid rounding final score * Version dropdown: jump to same file if it exists (#1840) * Update paths * Add indicator and jump to correct file * Extract dropdown html * Update dropdown when switching files * Update pdfUrls to use _path methods * Add newline * Add missing semicolon to view.js.erb * Use template strings for this.value * Use document.location.href * Don't put asterisk for current version * [Breaking] Create per-user handin subdirectories (#1831) * Create per-user subdirectories * Create per-user archive subdirectories * Use id for archive filename * Refactor archive_handin * Implement Backwards Compatibility to Per-user Handin Subdirectories (#1846) * initial patch code to fall back to old handin file path if new handin file not found * - update path finding functions to check for existence old path/file first, then return new path * address newline nit * actually address newline nit --------- Co-authored-by: Joey Wildman <[email protected]> * [Cherry Picked] Adds modifySubmissionScores hook (#1866) Adds modifySubmissionScores hook (#1832) * Adds modifyScores hook * change name from modifyScores to modifySubmissionScores * Add problems to the modifySubmissionScores hook * adds assessment variable hook * Add a default lookback limit to previous_submissions * Fix order * Append error message to feedback * Remove comment * Add filter on exclude autograding in progress * Exclude autograding * Add docs for modify submission score * Fix error, and add reference to argument types * Refactor develop tests to use new framework, commit correct schema.rb (for mysql) * Run rubocop * Clean up context blocks in attachments_controller_spec by defining u at top of context block instead for each shared example --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: Evan Shi <[email protected]> Co-authored-by: lykimchee <[email protected]> Co-authored-by: Damian Ho <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: jlge <[email protected]> Co-authored-by: Victor Huang <[email protected]> Co-authored-by: Umar Alkafaween <[email protected]> Co-authored-by: Michelle Liu <[email protected]> Co-authored-by: Joanna Ge <[email protected]>
1 parent 9ab11b9 commit bdb5682

File tree

83 files changed

+1827
-1253
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+1827
-1253
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ doc/
5353
out.txt
5454
.vscode/
5555
.byebug_history
56-
56+
node_modules/
5757
# Credentials
5858
.env
5959

Gemfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ GEM
267267
stringio
268268
public_suffix (4.0.7)
269269
racc (1.6.1)
270-
rack (2.2.6.2)
270+
rack (2.2.6.4)
271271
rack-attack (6.6.1)
272272
rack (>= 1.0, < 3)
273273
rack-protection (2.2.0)

app/assets/javascripts/annotations.js

Lines changed: 27 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -84,31 +84,39 @@ function refreshAnnotations() {
8484
});
8585
}
8686

87+
// Updates relevant elements of the speedgrader when a new file is selected
88+
function loadFile(newFile) {
89+
// Update the code viewer and symbol tree with the cached data
90+
$('#code-box').replaceWith(newFile.codeBox);
91+
$('#symbol-tree-container').replaceWith(newFile.symbolTree);
92+
93+
// Add syntax highlighting to the new code viewer
94+
$('pre code').each(function () {
95+
hljs.highlightBlock(this);
96+
});
97+
98+
// Update the page URL
99+
history.replaceState(null, null, newFile.url);
100+
101+
// Update version dropdown
102+
$('#version-dropdown').replaceWith(newFile.versionDropdown);
103+
104+
// Update version buttons
105+
$('#version-links').replaceWith(newFile.versionLinks);
106+
107+
displayAnnotations();
108+
attachEvents();
109+
}
110+
87111
// Returns true if the file was cached, false otherwise
88112
function changeFile(headerPos) {
89113
$('#code-box').addClass('loading');
90114
setActiveFilePos(headerPos);
91115

92116
// If we've cached this file locally, just get it
93-
if (localCache[headerPos] != undefined) {
117+
if (localCache[headerPos] !== undefined) {
94118
newFile = localCache[headerPos];
95-
// Update the code viewer and symbol tree with the cached data
96-
$('#code-box').replaceWith(newFile.codeBox);
97-
$('#symbol-tree-container').replaceWith(newFile.symbolTree);
98-
99-
// Add syntax highlighting to the new code viewer
100-
$('pre code').each(function () {
101-
hljs.highlightBlock(this);
102-
});
103-
104-
// Update the page URL
105-
history.replaceState(null, null, newFile.url);
106-
107-
// Update version buttons
108-
$('#version-links').replaceWith(newFile.versionLinks);
109-
110-
displayAnnotations();
111-
attachEvents();
119+
loadFile(newFile);
112120
return true;
113121
}
114122
return false;
@@ -120,6 +128,7 @@ function purgeCurrentPageCache() {
120128
pdf: false,
121129
symbolTree: `<div id="symbol-tree-box">${$('#symbol-tree-box').html()}</div>`,
122130
versionLinks: `<span id="version-links">${$('#version-links').html()}</span>`,
131+
versionDropdown: `<span id="version-dropdown">${$('#version-dropdown').html()}</span>`,
123132
url: window.location.href,
124133
};
125134
}

app/assets/javascripts/git_submission.js

Lines changed: 38 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@
33

44
const github_endpoints = {
55
get_repos: '/github_integration/get_repositories',
6-
get_branches: '/github_integration/get_branches',
6+
get_branches: '/github_integration/get_branches',
7+
get_commits: '/github_integration/get_commits',
78
}
89

910
function update_repos() {
10-
$.getJSON(github_endpoints['get_repos'], function(data, status){
11+
$.getJSON(github_endpoints['get_repos'], function(data, status) {
1112
repos_html = "";
1213
data.forEach(repo => {
1314
repos_html += `<div class="item">${repo["repo_name"]}</div>`;
@@ -16,11 +17,24 @@ function update_repos() {
1617
});
1718
}
1819

19-
function update_branches(repo) {
20+
function clear_branches() {
2021
$("#branch-dropdown input[name='branch']").addClass("noselection");
2122
$("#branch-dropdown .text").addClass("default");
2223
$("#branch-dropdown .text").text("Select branch");
23-
$.getJSON(github_endpoints['get_branches'], {repository: repo}, function(data, status){
24+
$("#branch-dropdown .menu").html("");
25+
}
26+
27+
function clear_commits() {
28+
$("#commit-dropdown input[name='commit']").addClass("noselection");
29+
$("#commit-dropdown .text").addClass("default");
30+
$("#commit-dropdown .text").text("Select commit");
31+
$("#commit-dropdown .menu").html("");
32+
}
33+
34+
function update_branches(repo) {
35+
clear_branches();
36+
clear_commits();
37+
$.getJSON(github_endpoints['get_branches'], {repository: repo}, function(data, status) {
2438
branches_html = "";
2539
data.forEach(branch => {
2640
branches_html += `<div class="item">${branch["name"]}</div>`;
@@ -29,6 +43,17 @@ function update_branches(repo) {
2943
});
3044
}
3145

46+
function update_commits(repo, branch) {
47+
clear_commits();
48+
$.getJSON(github_endpoints['get_commits'], {repository: repo, branch: branch}, function(data, status) {
49+
commits_html = "";
50+
data.forEach(commit => {
51+
commits_html += `<div data-value="${commit["sha"]}" class="item">${commit["sha"]} (${commit["msg"]})</div>`;
52+
});
53+
$("#commit-dropdown .menu").html(commits_html);
54+
});
55+
}
56+
3257
$("a[data-tab=github]").click(function (e) {
3358
update_repos();
3459
});
@@ -38,6 +63,12 @@ $("#repo-dropdown").change(function() {
3863
update_branches(repo_name);
3964
});
4065

66+
$("#branch-dropdown").change(function() {
67+
var repo_name = $("#repo-dropdown input[name='repo']").val();
68+
var branch_name = $("#branch-dropdown input[name='branch']").val();
69+
update_commits(repo_name, branch_name);
70+
});
71+
4172
// https://stackoverflow.com/questions/5524045/jquery-non-ajax-post
4273
function submit(action, method, input) {
4374
'use strict';
@@ -65,8 +96,9 @@ $(document).on("click", "input[type='submit']", function (e) {
6596
e.preventDefault();
6697
var repo_name = $("#repo-dropdown input[name='repo']").val();
6798
var branch_name = $("#branch-dropdown input[name='branch']").val();
99+
var commit_sha = $("#commit-dropdown input[name='commit']").val();
68100
var token = $("meta[name=csrf-token]").attr("content");
69-
var params = {repo: repo_name, branch: branch_name, authenticity_token: token};
101+
var params = {repo: repo_name, branch: branch_name, commit: commit_sha, authenticity_token: token};
70102
var assessment_nav = $(".sub-navigation").find(".item").last();
71103
var assessment_url = assessment_nav.find("a").attr("href");
72104
var url = assessment_url + "/handin"
@@ -75,6 +107,7 @@ $(document).on("click", "input[type='submit']", function (e) {
75107
});
76108

77109
$(document).ready(function () {
110+
$('.ui.dropdown input[type="hidden"]').val("");
78111
$('.ui.dropdown').dropdown({
79112
fullTextSearch: true,
80113
});

app/assets/javascripts/table_floating_header.js

Lines changed: 0 additions & 147 deletions
This file was deleted.

app/assets/stylesheets/annotations.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
.submission-controls select {
1515
height: 2rem;
1616
display: inline-block;
17-
width: 50px;
17+
width: 5ch;
1818
}
1919

2020
.submission-controls .btn {

app/assets/stylesheets/datatable.adapter.css

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,3 +68,9 @@ div.dataTables_paginate span>a {
6868
width: 15px;
6969
text-align: center;
7070
}
71+
72+
th {
73+
z-index: 1;
74+
position: sticky;
75+
top: 0;
76+
}

app/controllers/assessment/handin.rb

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def handin
3737
github_integration = current_user.github_integration
3838

3939
begin
40-
@tarfile_path = github_integration.clone_repo(params["repo"], params["branch"], @assessment.max_size * (2 ** 20))
40+
@tarfile_path = github_integration.clone_repo(params["repo"], params["branch"], params["commit"], @assessment.max_size * (2 ** 20))
4141
rescue StandardError => msg
4242
flash[:error] = msg
4343
redirect_to(action: :show)
@@ -354,8 +354,6 @@ def validateHandin_forHTML
354354
return false
355355
end
356356

357-
validate_custom_form
358-
359357
validity = validateHandin(params[:submission]["file"].size,
360358
params[:submission]["file"].content_type,
361359
params[:submission]["file"].original_filename)
@@ -401,18 +399,6 @@ def validateHandinForGroups_forHTML
401399
return false
402400
end
403401

404-
def validate_custom_form
405-
# check if custom form exists
406-
if @assessment.has_custom_form
407-
for i in 0..@assessment.getTextfields.size - 1
408-
if params[:submission][("formfield" + (i + 1).to_s).to_sym].blank?
409-
flash[:error] = @assessment.getTextfields[i] + " is a required field."
410-
return false
411-
end
412-
end
413-
end
414-
end
415-
416402
def handle_validity(validity)
417403
case validity
418404
when :valid

0 commit comments

Comments
 (0)