Skip to content

Commit

Permalink
Merge master into develop (#1867)
Browse files Browse the repository at this point in the history
* 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 <damian_ho_xu_yang@yahoo.com>

* 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] <support@github.com>
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] <support@github.com>
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 <victorhuangwq@gmail.com>

* 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 <joannage87@gmail.com>
Co-authored-by: Joey Wildman <josephwildman88@gmail.com>

* 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 <josephwildman88@gmail.com>

* [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] <support@github.com>
Co-authored-by: Evan Shi <14984764+evanyeyeye@users.noreply.github.com>
Co-authored-by: lykimchee <lchaeryn5863@gmail.com>
Co-authored-by: Damian Ho <damian_ho_xu_yang@yahoo.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: jlge <45646252+jlge@users.noreply.github.com>
Co-authored-by: Victor Huang <victorhuangwq@gmail.com>
Co-authored-by: Umar Alkafaween <30433769+umar221b@users.noreply.github.com>
Co-authored-by: Michelle Liu <mliuu3259@gmail.com>
Co-authored-by: Joanna Ge <joannage87@gmail.com>
  • Loading branch information
10 people authored Apr 8, 2023
1 parent 9ab11b9 commit bdb5682
Show file tree
Hide file tree
Showing 83 changed files with 1,827 additions and 1,253 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ doc/
out.txt
.vscode/
.byebug_history

node_modules/
# Credentials
.env

Expand Down
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ GEM
stringio
public_suffix (4.0.7)
racc (1.6.1)
rack (2.2.6.2)
rack (2.2.6.4)
rack-attack (6.6.1)
rack (>= 1.0, < 3)
rack-protection (2.2.0)
Expand Down
45 changes: 27 additions & 18 deletions app/assets/javascripts/annotations.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,31 +84,39 @@ function refreshAnnotations() {
});
}

// Updates relevant elements of the speedgrader when a new file is selected
function loadFile(newFile) {
// Update the code viewer and symbol tree with the cached data
$('#code-box').replaceWith(newFile.codeBox);
$('#symbol-tree-container').replaceWith(newFile.symbolTree);

// Add syntax highlighting to the new code viewer
$('pre code').each(function () {
hljs.highlightBlock(this);
});

// Update the page URL
history.replaceState(null, null, newFile.url);

// Update version dropdown
$('#version-dropdown').replaceWith(newFile.versionDropdown);

// Update version buttons
$('#version-links').replaceWith(newFile.versionLinks);

displayAnnotations();
attachEvents();
}

// Returns true if the file was cached, false otherwise
function changeFile(headerPos) {
$('#code-box').addClass('loading');
setActiveFilePos(headerPos);

// If we've cached this file locally, just get it
if (localCache[headerPos] != undefined) {
if (localCache[headerPos] !== undefined) {
newFile = localCache[headerPos];
// Update the code viewer and symbol tree with the cached data
$('#code-box').replaceWith(newFile.codeBox);
$('#symbol-tree-container').replaceWith(newFile.symbolTree);

// Add syntax highlighting to the new code viewer
$('pre code').each(function () {
hljs.highlightBlock(this);
});

// Update the page URL
history.replaceState(null, null, newFile.url);

// Update version buttons
$('#version-links').replaceWith(newFile.versionLinks);

displayAnnotations();
attachEvents();
loadFile(newFile);
return true;
}
return false;
Expand All @@ -120,6 +128,7 @@ function purgeCurrentPageCache() {
pdf: false,
symbolTree: `<div id="symbol-tree-box">${$('#symbol-tree-box').html()}</div>`,
versionLinks: `<span id="version-links">${$('#version-links').html()}</span>`,
versionDropdown: `<span id="version-dropdown">${$('#version-dropdown').html()}</span>`,
url: window.location.href,
};
}
Expand Down
43 changes: 38 additions & 5 deletions app/assets/javascripts/git_submission.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@

const github_endpoints = {
get_repos: '/github_integration/get_repositories',
get_branches: '/github_integration/get_branches',
get_branches: '/github_integration/get_branches',
get_commits: '/github_integration/get_commits',
}

function update_repos() {
$.getJSON(github_endpoints['get_repos'], function(data, status){
$.getJSON(github_endpoints['get_repos'], function(data, status) {
repos_html = "";
data.forEach(repo => {
repos_html += `<div class="item">${repo["repo_name"]}</div>`;
Expand All @@ -16,11 +17,24 @@ function update_repos() {
});
}

function update_branches(repo) {
function clear_branches() {
$("#branch-dropdown input[name='branch']").addClass("noselection");
$("#branch-dropdown .text").addClass("default");
$("#branch-dropdown .text").text("Select branch");
$.getJSON(github_endpoints['get_branches'], {repository: repo}, function(data, status){
$("#branch-dropdown .menu").html("");
}

function clear_commits() {
$("#commit-dropdown input[name='commit']").addClass("noselection");
$("#commit-dropdown .text").addClass("default");
$("#commit-dropdown .text").text("Select commit");
$("#commit-dropdown .menu").html("");
}

function update_branches(repo) {
clear_branches();
clear_commits();
$.getJSON(github_endpoints['get_branches'], {repository: repo}, function(data, status) {
branches_html = "";
data.forEach(branch => {
branches_html += `<div class="item">${branch["name"]}</div>`;
Expand All @@ -29,6 +43,17 @@ function update_branches(repo) {
});
}

function update_commits(repo, branch) {
clear_commits();
$.getJSON(github_endpoints['get_commits'], {repository: repo, branch: branch}, function(data, status) {
commits_html = "";
data.forEach(commit => {
commits_html += `<div data-value="${commit["sha"]}" class="item">${commit["sha"]} (${commit["msg"]})</div>`;
});
$("#commit-dropdown .menu").html(commits_html);
});
}

$("a[data-tab=github]").click(function (e) {
update_repos();
});
Expand All @@ -38,6 +63,12 @@ $("#repo-dropdown").change(function() {
update_branches(repo_name);
});

$("#branch-dropdown").change(function() {
var repo_name = $("#repo-dropdown input[name='repo']").val();
var branch_name = $("#branch-dropdown input[name='branch']").val();
update_commits(repo_name, branch_name);
});

// https://stackoverflow.com/questions/5524045/jquery-non-ajax-post
function submit(action, method, input) {
'use strict';
Expand Down Expand Up @@ -65,8 +96,9 @@ $(document).on("click", "input[type='submit']", function (e) {
e.preventDefault();
var repo_name = $("#repo-dropdown input[name='repo']").val();
var branch_name = $("#branch-dropdown input[name='branch']").val();
var commit_sha = $("#commit-dropdown input[name='commit']").val();
var token = $("meta[name=csrf-token]").attr("content");
var params = {repo: repo_name, branch: branch_name, authenticity_token: token};
var params = {repo: repo_name, branch: branch_name, commit: commit_sha, authenticity_token: token};
var assessment_nav = $(".sub-navigation").find(".item").last();
var assessment_url = assessment_nav.find("a").attr("href");
var url = assessment_url + "/handin"
Expand All @@ -75,6 +107,7 @@ $(document).on("click", "input[type='submit']", function (e) {
});

$(document).ready(function () {
$('.ui.dropdown input[type="hidden"]').val("");
$('.ui.dropdown').dropdown({
fullTextSearch: true,
});
Expand Down
147 changes: 0 additions & 147 deletions app/assets/javascripts/table_floating_header.js

This file was deleted.

2 changes: 1 addition & 1 deletion app/assets/stylesheets/annotations.scss
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
.submission-controls select {
height: 2rem;
display: inline-block;
width: 50px;
width: 5ch;
}

.submission-controls .btn {
Expand Down
6 changes: 6 additions & 0 deletions app/assets/stylesheets/datatable.adapter.css
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,9 @@ div.dataTables_paginate span>a {
width: 15px;
text-align: center;
}

th {
z-index: 1;
position: sticky;
top: 0;
}
16 changes: 1 addition & 15 deletions app/controllers/assessment/handin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def handin
github_integration = current_user.github_integration

begin
@tarfile_path = github_integration.clone_repo(params["repo"], params["branch"], @assessment.max_size * (2 ** 20))
@tarfile_path = github_integration.clone_repo(params["repo"], params["branch"], params["commit"], @assessment.max_size * (2 ** 20))
rescue StandardError => msg
flash[:error] = msg
redirect_to(action: :show)
Expand Down Expand Up @@ -354,8 +354,6 @@ def validateHandin_forHTML
return false
end

validate_custom_form

validity = validateHandin(params[:submission]["file"].size,
params[:submission]["file"].content_type,
params[:submission]["file"].original_filename)
Expand Down Expand Up @@ -401,18 +399,6 @@ def validateHandinForGroups_forHTML
return false
end

def validate_custom_form
# check if custom form exists
if @assessment.has_custom_form
for i in 0..@assessment.getTextfields.size - 1
if params[:submission][("formfield" + (i + 1).to_s).to_sym].blank?
flash[:error] = @assessment.getTextfields[i] + " is a required field."
return false
end
end
end
end

def handle_validity(validity)
case validity
when :valid
Expand Down
Loading

0 comments on commit bdb5682

Please sign in to comment.