Skip to content

Commit

Permalink
fixing everything that broke because someone decided to change the sc…
Browse files Browse the repository at this point in the history
…hema without telling anyone else...
  • Loading branch information
ekandell committed Apr 26, 2024
1 parent 54a9b2e commit f383fea
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 17 deletions.
2 changes: 1 addition & 1 deletion app/controllers/api/v1/extensions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def find_extension_params
@lms = Lms.find(params[:lms_id])
@course = Course.find(params[:course_id])
@assignment = Assignment.find(params[:assignment_id])
@course_to_lms = CourseToLms.where(lms_id: @lms.id, course_id: @course.id).take
@course_to_lms = CourseToLms.find(@assignment.course_to_lms_id)
end
end
end
Expand Down
15 changes: 7 additions & 8 deletions db/seeds.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,6 @@
})


test_assignment = Assignment.create!({
lms_id: canvas.id,
name: "Test Assignment",
external_assignment_id: "11111"
})


test_course = Course.create!({
course_name: "Test Course",
})
Expand All @@ -40,6 +33,12 @@
external_course_id: "22222"
})

test_assignment = Assignment.create!({
course_to_lms_id: test_course_to_lms.id,
name: "Test Assignment",
external_assignment_id: "11111"
})

test_user = User.create!({
email: "[email protected]",
})
Expand Down Expand Up @@ -77,7 +76,7 @@
})

real_assignment = Assignment.create!({
lms_id: canvas.id,
course_to_lms_id: real_course_to_lms.id,
name: "Seed Data Testing",
external_assignment_id: "8741483"
})
Expand Down
12 changes: 8 additions & 4 deletions spec/controllers/api/v1/assignments_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,14 @@ def json_response
end

after do
Assignment.delete_all
CourseToLms.delete_all
Course.delete_all
Lms.delete_all
LmsCredential.destroy_all
Extension.destroy_all
Assignment.destroy_all
CourseToLms.destroy_all
UserToCourse.destroy_all
Course.destroy_all
Lms.destroy_all
User.destroy_all
end

describe "GET /api/v1/courses/:course_id/lmss/:lms_id/assignments" do
Expand Down
2 changes: 1 addition & 1 deletion spec/controllers/api/v1/extensions_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ module V1
@assignment = Assignment.take
@extension = Extension.take
@lms = Lms.take
@course_to_lms = CourseToLms.where(lms_id: @lms.id, course_id: @course.id).take
@course_to_lms = CourseToLms.find(@assignment.course_to_lms_id)
@mock_student_uid = 123
@mock_new_due_date = '2024-04-16T16:00:00Z'

Expand Down
11 changes: 8 additions & 3 deletions spec/controllers/api/v1/lmss_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,14 @@ def json_response

after do
# Clean up the specifically created data
CourseToLms.delete_all
Course.delete_all
Lms.delete_all
LmsCredential.destroy_all
Extension.destroy_all
Assignment.destroy_all
CourseToLms.destroy_all
UserToCourse.destroy_all
Course.destroy_all
Lms.destroy_all
User.destroy_all
end

describe 'POST #create' do
Expand Down

0 comments on commit f383fea

Please sign in to comment.