diff --git a/app/views/accounts/_sis_batch_counts.html.erb b/app/views/accounts/_sis_batch_counts.html.erb index d9aac3d029c..36da50fd692 100644 --- a/app/views/accounts/_sis_batch_counts.html.erb +++ b/app/views/accounts/_sis_batch_counts.html.erb @@ -9,6 +9,8 @@
  • <%= before_label(t(:users_label, "Users")) %> <%= counts[:users] %>
  • <%= before_label(t(:enrollments_label, "Enrollments")) %> <%= counts[:enrollments] %>
  • <%= before_label(t(:crosslists_label, "Crosslists")) %> <%= counts[:xlists] %>
  • +
  • <%= before_label(t(:groups, "Groups")) %> <%= counts[:groups] %>
  • +
  • <%= before_label(t(:group_enrollments, "Group Enrollments")) %> <%= counts[:group_memberships] %>
  • diff --git a/lib/sis/csv/group_importer.rb b/lib/sis/csv/group_importer.rb index 117dc116108..841350898ae 100644 --- a/lib/sis/csv/group_importer.rb +++ b/lib/sis/csv/group_importer.rb @@ -23,7 +23,7 @@ module SIS # note these are account-level groups, not course groups class GroupImporter < BaseImporter def self.is_group_csv?(row) - row.header?('group_id') && row.header?('account_id') + row.header?('group_id') && row.header?('name') end # expected columns diff --git a/public/javascripts/sis_import.js b/public/javascripts/sis_import.js index d5de51b4c10..4c0879780d1 100644 --- a/public/javascripts/sis_import.js +++ b/public/javascripts/sis_import.js @@ -84,6 +84,8 @@ $(document).ready(function(event) { output += "
  • " + I18n.t('import_counts.users', "Users: %{user_count}", {user_count: batch.data.counts.users}) + "
  • "; output += "
  • " + I18n.t('import_counts.enrollments', "Enrollments: %{enrollment_count}", {enrollment_count: batch.data.counts.enrollments}) + "
  • "; output += "
  • " + I18n.t('import_counts.crosslists', "Crosslists: %{crosslist_count}", {crosslist_count: batch.data.counts.xlists}) + "
  • "; + output += "
  • " + I18n.t('import_counts.groups', "Groups: %{group_count}", {group_count: batch.data.counts.groups}) + "
  • "; + output += "
  • " + I18n.t('import_counts.group_enrollments', "Group Enrollments: %{group_enrollments_count}", {group_enrollments_count: batch.data.counts.group_memberships}) + "
  • "; output += ""; return output diff --git a/spec/lib/sis/csv/group_importer_spec.rb b/spec/lib/sis/csv/group_importer_spec.rb index ce23f13935c..dfdf569dc33 100644 --- a/spec/lib/sis/csv/group_importer_spec.rb +++ b/spec/lib/sis/csv/group_importer_spec.rb @@ -59,6 +59,18 @@ describe SIS::CSV::GroupImporter do groups.map(&:workflow_state).should == %w(available deleted) end + it "should create groups with no account id column" do + account_model + process_csv_data_cleanly( + "group_id,name,status", + "G001,Group 1,available") + groups = Group.all(:order => :id) + groups.map(&:account_id).should == [@account.id] + groups.map(&:sis_source_id).should == %w(G001) + groups.map(&:name).should == ["Group 1"] + groups.map(&:workflow_state).should == %w(available) + end + it "should update group attributes" do @sub = @account.sub_accounts.create!(:name => 'sub') @sub.update_attribute('sis_source_id', 'A002') diff --git a/spec/views/accounts/_sis_batch_counts.html.erb_spec.rb b/spec/views/accounts/_sis_batch_counts.html.erb_spec.rb new file mode 100644 index 00000000000..1db4ba29df0 --- /dev/null +++ b/spec/views/accounts/_sis_batch_counts.html.erb_spec.rb @@ -0,0 +1,37 @@ +# +# Copyright (C) 2011 Instructure, Inc. +# +# This file is part of Canvas. +# +# Canvas is free software: you can redistribute it and/or modify it under +# the terms of the GNU Affero General Public License as published by the Free +# Software Foundation, version 3 of the License. +# +# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR +# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more +# details. +# +# You should have received a copy of the GNU Affero General Public License along +# with this program. If not, see . +# + +require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +require File.expand_path(File.dirname(__FILE__) + '/../views_helper') + +describe "accounts/_sis_batch_counts.html.erb" do + + it "should render sis count data" do + data = {:counts => {:xlists => 2, :enrollments => 3, :courses => 5, :users => 6, :terms => 6, :group_memberships => 7, :groups => 8, :sections => 9, :accounts => 10}} + report = mock() + report.expects(:data).returns(data) + render :partial => 'accounts/sis_batch_counts', :object => report + + map = {:xlists => "Crosslists", :group_memberships => "Group Enrollments"} + + data[:counts].each_pair do |type, count| + name = map[type] || type.to_s.capitalize + response.body.should =~ /#{name}: #{count}/ + end + end +end \ No newline at end of file