Skip to content

Commit

Permalink
Merge branch 'master' into dependabot/bundler/bundler-6e3bc67060
Browse files Browse the repository at this point in the history
  • Loading branch information
KesterTan authored Sep 3, 2024
2 parents 8a43acb + af09f58 commit d492c0f
Show file tree
Hide file tree
Showing 8 changed files with 221 additions and 13 deletions.
12 changes: 10 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,13 @@ pip install --user mkdocs-material
To run and preview this locally, run:

```bash
mkdocs serve
python3 -m mkdocs serve
```

Once your updated documentation is in `master`, Jenkins will automatically run a job to update the docs. You can trigger a manual update with

```bash
mkdocs gh-deploy
python3 -m mkdocs gh-deploy
```

This will build the site using the branch you are currently in (hopefully `master`), place the built HTML files into the `gh-pages` branch, and push them to GitHub. GitHub will then automatically deploy the new content in `gh-pages`.
Expand All @@ -115,6 +115,14 @@ Please feel free to use Autolab at your school/organization. If you run into any


## Changelog

### [v3.0.0](https://github.com/autolab/Autolab/releases/tag/v3.0.0) (2024/07/24) UI-based deployment configuration, Simple File Manager, Export / Import Course, Tango, Grading Improvements
- Configuration of authentication, Github, SMTP moved to UI
- Simple File Manager to manage files in courses through a UI
- Import / Export Course data in one go, with improved assessment importing
- Improvements to grading UI/UX such as an improved Gradebook, Code Diff Viewer, Starred Problems
- Improvements to autograding with direct Docker file uploading and the option to selectively disable network access

### [v2.12.0](https://github.com/autolab/Autolab/releases/tag/v2.12.0) (2024/01/20) Attachment categories and visual cues
- Ruby upgraded to 3.2.2
- Rails upgraded to 6.1.7.6
Expand Down
7 changes: 3 additions & 4 deletions app/controllers/submissions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -143,19 +143,18 @@ def destroyConfirm; end
## THIS MARKS THE END OF RESTful ROUTES
##

# TODONE? THIS MAY DELETE MOST OF YOUR USERS. USE WITH CAUTION.
action_auth_level :missing, :instructor
def missing
@submissions = @assessment.submissions

cuds = @course.students.to_a
missing_submission_students = @course.students.to_a
@missing = []

@submissions.each do |submission|
cuds.delete(submission.course_user_datum)
missing_submission_students.delete(submission.course_user_datum)
end

cuds.each_with_index do |c, i|
missing_submission_students.each_with_index do |c, i|
@missing[i] = {}
@missing[i][:id] = c.id
@missing[i][:email] = c.email
Expand Down
4 changes: 2 additions & 2 deletions app/views/assessments/_edit_basic.html.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<%= f.text_field :name, disabled: true, class: "",
help_text: "The unique (for this course) name of the assessment. Must be
lowercase alphanumeric (no punctuation). E.g.,
<kbd>malloclab</kbd>".html_safe %>
a valid Ruby Identifier. See
<a href='https://docs.autolabproject.com/lab/#assessment-naming-rules'>documentation</a> for details".html_safe %>
<%= f.text_field :display_name, placeholder: "Homework0",
help_text: "Name that will be displayed on the course home page. E.g.,
Expand Down
2 changes: 1 addition & 1 deletion app/views/scoreboards/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
<% end %>
<% else %>
<%# this should be guaranteed to be an array, but for redundancy, check that entry is array %>
<% if grade[:entry].is_a?(Array) && grade[:entry].length > i %>
<% if grade[:entry].is_a?(Array) %>
<% grade[:entry].each do |column| %>
<td><%= column %></td>
<% end %>
Expand Down
2 changes: 1 addition & 1 deletion config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ class Application < Rails::Application
config.middleware.use Rack::Attack

# site version
config.site_version = "2.12.0"
config.site_version = "3.0.0"

# Set application host for mailer
config.action_mailer.default_url_options = { host: ENV['MAILER_HOST'] || "YOUR_APP_HOST" }
Expand Down
6 changes: 3 additions & 3 deletions docs/installation/lti_integration.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ on Autolab's end as well.
{
"title": "Autolab Integration",
"description": "Autolab is an open-source autograding service developed by students, for students",
"oidc_initiation_url":"https://<your-autolab-domain>/lti_launch/oidc_login/",
"target_link_uri":"https://<your-autolab-domain>/lti_launch/launch/",
"oidc_initiation_url":"https://<your-autolab-domain>/lti_launch/oidc_login",
"target_link_uri":"https://<your-autolab-domain>/lti_launch/launch",
"scopes": [
"https://purl.imsglobal.org/spec/lti-nrps/scope/contextmembership.readonly"
],
Expand All @@ -83,7 +83,7 @@ on Autolab's end as well.
"enabled": true,
"placement":"course_navigation",
"message_type": "LtiResourceLinkRequest",
"target_link_uri": "https://<your-autolab-domain>/lti_launch/launch/",
"target_link_uri": "https://<your-autolab-domain>/lti_launch/launch",
"icon_url":"<your-icon>",
"windowTarget": "_blank"
}
Expand Down
16 changes: 16 additions & 0 deletions spec/contexts_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,22 @@ def create_course_with_users(asmt_name: "testassessment")
puts "Built submissions"
end

def create_course_no_submissions_hash(asmt_name: "testasmtnosubs")
if @instructor_user.nil?
create_users
puts "Built users"
end
create_course
puts "Built courses"
create_assessment(asmt_name:)
puts "Built assessments"
create_problems
puts "Built problems"
{ course: @course, admin_user: @admin_user,
instructor_user: @instructor_user, course_assistant_user: @course_assistant_user,
students_cud: @students, assessment: @assessment }
end

def create_autograded_course_with_users
create_users
puts "Built users"
Expand Down
185 changes: 185 additions & 0 deletions spec/controllers/submissions_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,52 @@
end
end

shared_examples "destroyConfirm_failure" do
it "renders with failure" do
sign_in(user)
get :destroyConfirm, params: { course_name: @course.name, assessment_name: @assessment.name,
id: get_first_submission_by_assessment(@assessment).id }
expect(response).not_to be_successful
expect(response.body).not_to match(/Deleting a student's submission/m)
end
end

shared_examples "destroyConfirm_success" do
it "renders with success" do
sign_in(user)
get :destroyConfirm, params: { course_name: @course.name, assessment_name: @assessment.name,
id: get_first_submission_by_assessment(@assessment).id }
expect(response).to be_successful
expect(response.body).to match(/Deleting a student's submission/m)
end
end

shared_examples "destroy_success" do
it "destroys a student's submission" do
sign_in(user)
submission = get_first_submission_by_assessment(@assessment)
expect do
post :destroy, params: { course_name: @course.name, assessment_name: @assessment.name,
id: submission.id }
end.to change(Submission, :count).by(-1)
expect(response).to have_http_status(302)
expect(flash[:success])
end
end

shared_examples "destroy_failure" do
it "fails to destroy submission" do
sign_in(user)
submission = Submission.where(course_user_datum_id: get_first_cud_by_uid(user.id)).first
expect do
post :destroy, params: { course_name: @course.name, assessment_name: @assessment.name,
id: submission.id }
end.to change(Submission, :count).by(0)
expect(response).to have_http_status(302)
expect(flash[:error])
end
end

describe "#index" do
include_context "controllers shared context"
context "when user is Autolab admin" do
Expand Down Expand Up @@ -209,4 +255,143 @@
it_behaves_like "edit_failure"
end
end

describe "#downloadAll" do
include_context "controllers shared context"
context "when user is Instructor of class with submissions" do
let!(:user) { instructor_user }
it "downloads all submissions for an assessment" do
sign_in(user)
get :downloadAll, params: { course_name: @course.name, assessment_name: @assessment.name }
expect(response).to be_successful
Zip::File.open_buffer(response.parsed_body) do |zip_file|
zip_file.each do |entry|
if entry.file?
content = entry.get_input_stream.read
expect(content).to match(/Hello Dave/m)
end
end
end
end
end
end

describe "#download" do
include_context "controllers shared context"
context "when user is Instructor of class with submissions" do
let!(:user) { instructor_user }
it "downloads a student's submission" do
sign_in(user)
get :download, params: { course_name: @course.name, assessment_name: @assessment.name,
id: get_first_submission_by_assessment(@assessment).id }
expect(response).to be_successful
file_data = response.parsed_body
expect(file_data).to match(/Hello Dave/m)
end
end
context "when user is student and downloads own submission" do
let!(:user) { student_user }
it "downloads submission" do
sign_in(user)
submission = Submission.where(course_user_datum_id: get_first_cud_by_uid(user.id)).first
get :download, params: { course_name: @course.name, assessment_name: @assessment.name,
id: submission.id }
expect(response).to be_successful
file_data = response.parsed_body
expect(file_data).to match(/Hello Dave/m)
end
end
end

describe "#missing" do
include_context "controllers shared context"
context "when user is student" do
let!(:user) { student_user }
it "fails to get missing submissions" do
sign_in(user)
get :missing, params: { course_name: @course.name, assessment_name: @assessment.name }
expect(response).not_to be_successful
expect(response.body).not_to match(/Missing Submissions/m)
end
end
context "when user is Instructor of class with submissions" do
let!(:user) { instructor_user }
it "doesn't show missing submissions" do
sign_in(user)
get :missing, params: { course_name: @course.name, assessment_name: @assessment.name }
expect(response).to be_successful
expect(response.body).to match(/Missing Submissions/m)
expect(response.body).to match(/No Missing Submissions!/m)
@students.each do |student|
expect(response.body).not_to match(/#{student.email}/m)
end
end
end
context "when user is Instructor of asmt no submissions" do
let!(:hash) { create_course_no_submissions_hash }
let!(:user) { instructor_user }
it "shows missing submissions" do
sign_in(user)
get :missing, params: { course_name: @course.name, assessment_name: @assessment.name }
expect(response).to be_successful
expect(response.body).to match(/Missing Submissions/m)
expect(response.body).not_to match(/No Missing Submissions!/m)
@students.each do |student|
expect(response.body).to match(/#{student.email}/m)
end
end
end
end

describe "#destroyConfirm" do
include_context "controllers shared context"
context "when user is Autolab admin" do
let!(:user) { admin_user }
it_behaves_like "destroyConfirm_success"
end

context "when user is Instructor" do
let!(:user) { instructor_user }
it_behaves_like "destroyConfirm_success"
end

context "when user is student" do
let!(:user) { student_user }
it_behaves_like "destroyConfirm_failure"
end

context "when user is Course Assistant" do
let!(:user) { course_assistant_user }
it_behaves_like "destroyConfirm_failure"
end
end

describe "#destroy" do
include_context "controllers shared context"
context "when user is Autolab admin" do
let!(:user) { admin_user }
it_behaves_like "destroy_success"
end
context "when user is Instructor" do
let!(:user) { instructor_user }
it_behaves_like "destroy_success"
end
context "when user is student" do
let!(:user) { student_user }
it_behaves_like "destroy_failure"
end
context "when user is Course Assistant" do
let!(:user) { course_assistant_user }
it "fails to destroy submission" do
sign_in(user)
submission = get_first_submission_by_assessment(@assessment)
expect do
post :destroy, params: { course_name: @course.name, assessment_name: @assessment.name,
id: submission.id }
end.to change(Submission, :count).by(0)
expect(response).to have_http_status(302)
expect(flash[:error])
end
end
end
end

0 comments on commit d492c0f

Please sign in to comment.