Skip to content

Commit

Permalink
Merge pull request instructure#220 from va7map/misc-plugins
Browse files Browse the repository at this point in the history
Retire WebCT course import override + remove hardcoded SFU account names
  • Loading branch information
va7map committed Sep 9, 2015
2 parents e89b924 + 9d49b33 commit 3d5f584
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 28 deletions.
7 changes: 3 additions & 4 deletions vendor/plugins/sfu_api/app/controllers/api_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,8 @@ def course
end

def user
account_id = Account.find_by_name('Simon Fraser University').id
sfu_id = params[:sfu_id]
pseudonym = Pseudonym.where(:unique_id => sfu_id, :account_id => account_id).all
pseudonym = Pseudonym.where(:unique_id => sfu_id, :account_id => Account.default.id).all

raise(ActiveRecord::RecordNotFound) if pseudonym.empty?

Expand Down Expand Up @@ -62,7 +61,7 @@ def user
def terms
term_arr = []
if params[:term].nil?
terms = Account.find_by_name('Simon Fraser University').enrollment_terms.find(:all, :conditions => "workflow_state = 'active'", :order => 'sis_source_id DESC').delete_if {|t| t.name == 'Default Term'}
terms = Account.default.enrollment_terms.find(:all, :conditions => "workflow_state = 'active'", :order => 'sis_source_id DESC').delete_if {|t| t.name == 'Default Term'}
terms.each do |term|
term_info = {}
term_info["name"] = term.name
Expand All @@ -72,7 +71,7 @@ def terms
term_arr.push term_info
end
else
term = Account.find_by_name('Simon Fraser University').enrollment_terms.find(:all, :conditions => "sis_source_id = '#{params[:term]}'")
term = Account.default.enrollment_terms.find(:all, :conditions => "sis_source_id = '#{params[:term]}'")
term_info = {}
term_info["name"] = term.first.name
term_info["sis_source_id"] = term.first.sis_source_id
Expand Down
3 changes: 1 addition & 2 deletions vendor/plugins/sfu_api/app/model/sfu/rest.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ def maillist_membership_url
end

def canvas_sis_import_url
account_id = Account.find_by_name("Simon Fraser University").id
"#{canvas_server}/api/v1/accounts/#{account_id}/sis_imports.json?extension=csv"
"#{canvas_server}/api/v1/accounts/#{Account.default.id}/sis_imports.json?extension=csv"
end

def text(url, params)
Expand Down
21 changes: 0 additions & 21 deletions vendor/plugins/sfu_course_copy_importer/init.rb

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def new_adhoc
def create
req_user = User.find(@current_user.id).pseudonym.unique_id
selected_courses = []
account_id = Account.find_by_name("Simon Fraser University").id
account_id = Account.default.id
teacher_username = params[:username]
teacher2_username = params[:enroll_me]
teacher_sis_user_id = sis_user_id(teacher_username, account_id)
Expand Down

0 comments on commit 3d5f584

Please sign in to comment.