gaku 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rspec +1 -3
- data/.travis.yml +11 -8
- data/README.md +2 -4
- data/VERSION +1 -1
- data/core/Guardfile +24 -14
- data/core/Rakefile +0 -3
- data/core/app/controllers/gaku/admin/disposals_controller.rb +18 -45
- data/core/app/controllers/gaku/exams_controller.rb +2 -2
- data/core/app/controllers/gaku/syllabuses/exams_controller.rb +2 -2
- data/core/app/models/gaku/address.rb +1 -1
- data/core/app/models/gaku/disposal.rb +45 -0
- data/core/app/models/gaku/exam_portion.rb +1 -1
- data/core/app/models/gaku/student.rb +2 -2
- data/core/app/models/gaku/user.rb +1 -1
- data/core/app/models/gaku/versioning/student_version.rb +7 -12
- data/core/app/views/gaku/shared/overrides/students/_import_link.html.slim +0 -0
- data/core/app/views/gaku/shared/overrides/syllabuses/_import_link.html.slim +0 -0
- data/core/app/views/gaku/students/index.html.slim +1 -1
- data/core/app/views/gaku/syllabuses/index.html.slim +1 -1
- data/core/config/initializers/active_record.rb +1 -1
- data/core/config/routes.rb +1 -9
- data/core/db/default/gaku/attendance_types.rb +18 -8
- data/core/db/default/gaku/commute_method_types.rb +12 -20
- data/core/db/default/gaku/enrollment_status.rb +34 -31
- data/core/db/default/gaku/scholarship_statuses.rb +11 -8
- data/core/db/migrate/20120202111850_translated_tables.rb +52 -0
- data/core/db/migrate/{20120202111850_gaku_core.rb → 20131014065028_gaku_core.rb} +0 -86
- data/core/gaku_core.gemspec +43 -40
- data/core/lib/gaku/core.rb +2 -3
- data/core/lib/gaku/core/version.rb +1 -1
- data/core/lib/generators/gaku/install/install_generator.rb +1 -10
- data/core/spec/models/address_spec.rb +1 -1
- data/core/spec/spec_helper.rb +3 -3
- data/gaku_dependencies.rb +2 -12
- data/sample/db/sample/gaku/changes/student_changes.rb +3 -3
- data/sample/gaku_sample.gemspec +0 -1
- data/sample/lib/shared_sample_data.rb +2 -2
- metadata +12 -35
- data/core/app/controllers/gaku/students/importer_controller.rb +0 -75
- data/core/app/controllers/gaku/syllabuses/importer_controller.rb +0 -19
- data/core/app/models/gaku/import_file.rb +0 -5
- data/core/app/views/gaku/students/importer/index.html.slim +0 -26
- data/core/app/views/gaku/students/importer/roster_import_preview.html.slim +0 -4
- data/core/app/views/gaku/syllabuses/importer/index.html.slim +0 -14
- data/core/app/workers/gaku/importers/students/roster_worker.rb +0 -18
- data/core/app/workers/gaku/importers/students/school_station_zaikousei_worker.rb +0 -15
- data/core/config/initializers/sidekiq.rb +0 -6
- data/core/lib/gaku/exporters/roster_exporter.rb +0 -36
- data/core/lib/gaku/importers/key_mapper.rb +0 -19
- data/core/lib/gaku/importers/logger.rb +0 -10
- data/core/lib/gaku/importers/students/guardians.rb +0 -89
- data/core/lib/gaku/importers/students/personal_information.rb +0 -65
- data/core/lib/gaku/importers/students/roster.rb +0 -50
- data/core/lib/gaku/importers/students/roster_to_student.rb +0 -67
- data/core/lib/gaku/importers/students/school_station_zaikousei.rb +0 -109
- data/core/lib/gaku/importers/students/student_identity.rb +0 -17
- data/core/lib/gaku/testing/factories/import_file_factory.rb +0 -8
- data/core/lib/generators/gaku/install/templates/Procfile +0 -2
- data/core/lib/generators/gaku/install/templates/config/sidekiq.yml +0 -8
- data/core/spec/integration/importers/roster_spec.rb +0 -41
- data/core/spec/models/import_file_spec.rb +0 -9
- data/core/spec/requests/students/import_export.rb +0 -37
- data/core/spec/support/sample_roster.xls +0 -0
- data/core/spec/workers/roster_spec.rb +0 -13
@@ -1,17 +0,0 @@
|
|
1
|
-
module Gaku::Importers::Students::StudentIdentity
|
2
|
-
def normalize_id_num(id_number)
|
3
|
-
if id_number.to_i == 0 # ID is alphanumeric
|
4
|
-
return id_number.to_s
|
5
|
-
else # ID number is a number, defaulted to float from sheet data
|
6
|
-
return id_number.to_i.to_s
|
7
|
-
end
|
8
|
-
end
|
9
|
-
|
10
|
-
def find_student_by_student_ids(student_id_number, student_foreign_id_number = nil)
|
11
|
-
student = Gaku::Student.where(
|
12
|
-
student_id_number: normalize_id_num(student_id_number)).first
|
13
|
-
return student unless student.nil?
|
14
|
-
Gaku::Student.where(
|
15
|
-
student_foreign_id_number: normalize_id_num(student_foreign_id_number)).first
|
16
|
-
end
|
17
|
-
end
|
@@ -1,41 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'roo'
|
3
|
-
|
4
|
-
describe Gaku::Importers::Students::RosterWorker do
|
5
|
-
|
6
|
-
let!(:file) { create :import_file }
|
7
|
-
let(:importer) { Gaku::Importers::Students::Roster.new(file, nil) }
|
8
|
-
let(:book) { Roo::Spreadsheet.open(File.open(file)) }
|
9
|
-
|
10
|
-
let!(:email) { create(:contact_type, name: 'Email') }
|
11
|
-
let!(:phone) { create(:contact_type, name: 'Phone') }
|
12
|
-
|
13
|
-
|
14
|
-
describe 'initialize' do
|
15
|
-
xit 'sets book' do
|
16
|
-
importer
|
17
|
-
expect(importer.book).to_not be nil
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
describe '#process_book' do
|
22
|
-
xit 'creates students' do
|
23
|
-
expect do
|
24
|
-
importer.send(:process_book)
|
25
|
-
end.to change(Gaku::Student, :count).by(3)
|
26
|
-
end
|
27
|
-
|
28
|
-
xit 'creates contacts' do
|
29
|
-
expect do
|
30
|
-
importer.send(:process_book)
|
31
|
-
end.to change(Gaku::Contact, :count).by(4)
|
32
|
-
end
|
33
|
-
|
34
|
-
xit 'creates addresses' do
|
35
|
-
expect do
|
36
|
-
importer.send(:process_book)
|
37
|
-
end.to change(Gaku::Address, :count).by(1)
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
end
|
@@ -1,37 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'sidekiq/testing'
|
3
|
-
|
4
|
-
describe 'Student Sheet' do
|
5
|
-
|
6
|
-
before { as :admin }
|
7
|
-
|
8
|
-
let!(:student) { create(:student, name: 'John', surname: 'Doe') }
|
9
|
-
let!(:student2) { create(:student, name: 'Susumu', surname: 'Yokota') }
|
10
|
-
|
11
|
-
context 'download' do
|
12
|
-
it 'downloads registration sheet' do
|
13
|
-
visit gaku.students_path
|
14
|
-
# click_link 'import-students-link'
|
15
|
-
# click_link 'get_registration_csv'
|
16
|
-
|
17
|
-
# page.response_headers['Content-Type'].should eq "text/csv"
|
18
|
-
# page.should have_content 'surname,name,surname_reading,name_reading,gender,phone,email,birth_date,admitted'
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
context 'upload' do
|
23
|
-
it 'imports from sheet' do
|
24
|
-
visit gaku.students_path
|
25
|
-
expect do
|
26
|
-
click_link 'import-students-link'
|
27
|
-
select 'Roster', from: 'importer_importer_type'
|
28
|
-
absolute_path = Rails.root + '../support/sample_roster.xls'
|
29
|
-
attach_file 'importer_data_file', absolute_path
|
30
|
-
click_button 'Submit'
|
31
|
-
end.to change(Gaku::Student, :count).by 2
|
32
|
-
|
33
|
-
#page.should have_content 'created students:2'
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
end
|
Binary file
|
@@ -1,13 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Gaku::Importers::Students::Roster do
|
4
|
-
|
5
|
-
it 'add new job to worker' do
|
6
|
-
file_f = create(:import_file)
|
7
|
-
worker = Gaku::Importers::Students::RosterWorker
|
8
|
-
worker.perform_async(file_f.id)
|
9
|
-
expect(worker).to have(1).enqueued.jobs
|
10
|
-
end
|
11
|
-
|
12
|
-
end
|
13
|
-
|