gaku 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (65) hide show
  1. checksums.yaml +4 -4
  2. data/.rspec +1 -3
  3. data/.travis.yml +11 -8
  4. data/README.md +2 -4
  5. data/VERSION +1 -1
  6. data/core/Guardfile +24 -14
  7. data/core/Rakefile +0 -3
  8. data/core/app/controllers/gaku/admin/disposals_controller.rb +18 -45
  9. data/core/app/controllers/gaku/exams_controller.rb +2 -2
  10. data/core/app/controllers/gaku/syllabuses/exams_controller.rb +2 -2
  11. data/core/app/models/gaku/address.rb +1 -1
  12. data/core/app/models/gaku/disposal.rb +45 -0
  13. data/core/app/models/gaku/exam_portion.rb +1 -1
  14. data/core/app/models/gaku/student.rb +2 -2
  15. data/core/app/models/gaku/user.rb +1 -1
  16. data/core/app/models/gaku/versioning/student_version.rb +7 -12
  17. data/core/app/views/gaku/shared/overrides/students/_import_link.html.slim +0 -0
  18. data/core/app/views/gaku/shared/overrides/syllabuses/_import_link.html.slim +0 -0
  19. data/core/app/views/gaku/students/index.html.slim +1 -1
  20. data/core/app/views/gaku/syllabuses/index.html.slim +1 -1
  21. data/core/config/initializers/active_record.rb +1 -1
  22. data/core/config/routes.rb +1 -9
  23. data/core/db/default/gaku/attendance_types.rb +18 -8
  24. data/core/db/default/gaku/commute_method_types.rb +12 -20
  25. data/core/db/default/gaku/enrollment_status.rb +34 -31
  26. data/core/db/default/gaku/scholarship_statuses.rb +11 -8
  27. data/core/db/migrate/20120202111850_translated_tables.rb +52 -0
  28. data/core/db/migrate/{20120202111850_gaku_core.rb → 20131014065028_gaku_core.rb} +0 -86
  29. data/core/gaku_core.gemspec +43 -40
  30. data/core/lib/gaku/core.rb +2 -3
  31. data/core/lib/gaku/core/version.rb +1 -1
  32. data/core/lib/generators/gaku/install/install_generator.rb +1 -10
  33. data/core/spec/models/address_spec.rb +1 -1
  34. data/core/spec/spec_helper.rb +3 -3
  35. data/gaku_dependencies.rb +2 -12
  36. data/sample/db/sample/gaku/changes/student_changes.rb +3 -3
  37. data/sample/gaku_sample.gemspec +0 -1
  38. data/sample/lib/shared_sample_data.rb +2 -2
  39. metadata +12 -35
  40. data/core/app/controllers/gaku/students/importer_controller.rb +0 -75
  41. data/core/app/controllers/gaku/syllabuses/importer_controller.rb +0 -19
  42. data/core/app/models/gaku/import_file.rb +0 -5
  43. data/core/app/views/gaku/students/importer/index.html.slim +0 -26
  44. data/core/app/views/gaku/students/importer/roster_import_preview.html.slim +0 -4
  45. data/core/app/views/gaku/syllabuses/importer/index.html.slim +0 -14
  46. data/core/app/workers/gaku/importers/students/roster_worker.rb +0 -18
  47. data/core/app/workers/gaku/importers/students/school_station_zaikousei_worker.rb +0 -15
  48. data/core/config/initializers/sidekiq.rb +0 -6
  49. data/core/lib/gaku/exporters/roster_exporter.rb +0 -36
  50. data/core/lib/gaku/importers/key_mapper.rb +0 -19
  51. data/core/lib/gaku/importers/logger.rb +0 -10
  52. data/core/lib/gaku/importers/students/guardians.rb +0 -89
  53. data/core/lib/gaku/importers/students/personal_information.rb +0 -65
  54. data/core/lib/gaku/importers/students/roster.rb +0 -50
  55. data/core/lib/gaku/importers/students/roster_to_student.rb +0 -67
  56. data/core/lib/gaku/importers/students/school_station_zaikousei.rb +0 -109
  57. data/core/lib/gaku/importers/students/student_identity.rb +0 -17
  58. data/core/lib/gaku/testing/factories/import_file_factory.rb +0 -8
  59. data/core/lib/generators/gaku/install/templates/Procfile +0 -2
  60. data/core/lib/generators/gaku/install/templates/config/sidekiq.yml +0 -8
  61. data/core/spec/integration/importers/roster_spec.rb +0 -41
  62. data/core/spec/models/import_file_spec.rb +0 -9
  63. data/core/spec/requests/students/import_export.rb +0 -37
  64. data/core/spec/support/sample_roster.xls +0 -0
  65. data/core/spec/workers/roster_spec.rb +0 -13
@@ -18,16 +18,15 @@ require 'inherited_resources'
18
18
  require 'draper'
19
19
  require 'kaminari'
20
20
  require 'rails4_client_side_validations'
21
- require 'sidekiq/web'
22
21
  require 'paper_trail'
23
- require 'globalize3'
24
- require 'thinreports-rails'
22
+ require 'globalize'
25
23
  require 'bootstrap-sass'
26
24
  require 'bootstrap-datepicker-rails'
27
25
  require 'nested_form'
28
26
  require 'gaku_helpers'
29
27
  require 'gaku_forms'
30
28
  require 'gaku_nested_forms'
29
+ require 'thinreports-rails'
31
30
 
32
31
  module Gaku
33
32
 
@@ -1,5 +1,5 @@
1
1
  module Gaku
2
2
  def self.version
3
- '0.0.1'
3
+ '0.0.3'
4
4
  end
5
5
  end
@@ -34,16 +34,6 @@ module Gaku
34
34
  remove_file 'public/index.html'
35
35
  end
36
36
 
37
- def clear_logs
38
- remove_file 'log/sidekiq.log'
39
- add_file 'log/sidekiq.log'
40
- end
41
-
42
- def add_files
43
- template 'config/sidekiq.yml', 'config/sidekiq.yml'
44
- template 'Procfile', 'Procfile'
45
- end
46
-
47
37
  def setup_assets
48
38
  @lib_name = 'gaku'
49
39
  %w{javascripts stylesheets images}.each do |path|
@@ -58,6 +48,7 @@ module Gaku
58
48
  empty_directory 'app/overrides'
59
49
  end
60
50
 
51
+
61
52
  def configure_application
62
53
  application <<-APP
63
54
 
@@ -20,7 +20,7 @@ describe Gaku::Address do
20
20
  describe 'validations' do
21
21
  it { should validate_presence_of :address1 }
22
22
  it { should validate_presence_of :city }
23
- it { should validate_presence_of :country_id }
23
+ it { should validate_presence_of :country }
24
24
  end
25
25
 
26
26
  describe '.before_save' do
@@ -1,5 +1,4 @@
1
1
  require 'rubygems'
2
- require 'sidekiq'
3
2
 
4
3
  ENV['RAILS_ENV'] ||= 'test'
5
4
  require File.expand_path('../dummy/config/environment', __FILE__)
@@ -9,7 +8,9 @@ require 'database_cleaner'
9
8
  require 'active_record/fixtures'
10
9
  require 'factory_girl_rails'
11
10
  require 'paperclip/matchers'
12
- require 'sidekiq/testing'
11
+ require 'handy_controller_helpers'
12
+ require 'ffaker'
13
+ require 'shoulda-matchers'
13
14
 
14
15
  require 'gaku/testing/env'
15
16
  require 'gaku/testing/factories'
@@ -34,7 +35,6 @@ if ENV['COVERAGE']
34
35
  add_filter '/config/**'
35
36
  add_group 'Controllers', 'app/controllers'
36
37
  add_group 'Helpers', 'app/helpers'
37
- add_group 'Workers', 'app/workers'
38
38
  add_group 'Mailers', 'app/mailers'
39
39
  add_group 'Models', 'app/models'
40
40
  add_group 'Libraries', 'lib'
@@ -1,24 +1,14 @@
1
1
  source 'http://production.s3.rubygems.org'
2
2
 
3
- gem 'globalize3', github: 'globalize/globalize', branch: 'rails4', ref: '82b3b36308677745b261bd147dda00ed4560a25d'
4
-
5
3
  group :development do
6
4
  gem 'guard'
5
+ gem 'rubocop'
7
6
  gem 'guard-rspec'
8
7
  gem 'guard-bundler'
9
- gem 'guard-cop'
8
+ gem 'guard-rubocop'
10
9
  end
11
10
 
12
11
  group :test do
13
- gem 'rspec-rails'
14
- gem 'factory_girl_rails', '~> 4.2.1'
15
- gem 'ffaker'
16
- gem 'shoulda-matchers', '~> 2.4.0'
17
- gem 'handy_controller_helpers', '0.0.3'
18
- gem 'capybara', '= 1.1.3'
19
- gem 'selenium-webdriver'
20
- gem 'poltergeist'
21
- gem 'database_cleaner'
22
12
  gem 'simplecov'
23
13
  gem 'coveralls', require: false
24
14
  end
@@ -3,9 +3,9 @@ require 'shared_sample_data'
3
3
 
4
4
  say "Creating #{@count[:changes]} student changes ...".yellow
5
5
 
6
- commute_method_type = Gaku::CommuteMethodType.where(name: 'Changed CommuteMethodType').first_or_create!
7
- scholarship_status = Gaku::ScholarshipStatus.where(name: 'Changed Scholarship Status').first_or_create!
8
- enrollment_status = Gaku::EnrollmentStatus.where(code: 'changed_enrollment_status').first_or_create!
6
+ commute_method_type = Gaku::CommuteMethodType.create!(name: 'Changed CommuteMethodType')
7
+ scholarship_status = Gaku::ScholarshipStatus.create!(name: 'Changed Scholarship Status')
8
+ enrollment_status = Gaku::EnrollmentStatus.create!(code: 'changed_enrollment_status')
9
9
 
10
10
  counter = 0
11
11
 
@@ -20,5 +20,4 @@ Gem::Specification.new do |s|
20
20
  s.requirements << 'redis'
21
21
 
22
22
  s.add_dependency 'gaku_core', version
23
- s.add_dependency 'ffaker'
24
23
  end
@@ -9,8 +9,8 @@
9
9
  @home_phone = Gaku::ContactType.where(name: 'Home Phone').first_or_create!
10
10
  @email = Gaku::ContactType.where(name: 'Email').first_or_create!
11
11
  @enrollment_status = Gaku::EnrollmentStatus.where(code: 'admitted').first.try(:code)
12
- @commute_method_type = Gaku::CommuteMethodType.where(name: 'Superbike').first_or_create!
13
- @scholarship_status = Gaku::ScholarshipStatus.where(name: 'Charity').first_or_create!
12
+ @commute_method_type = Gaku::CommuteMethodType.create!(name: 'Superbike')
13
+ @scholarship_status = Gaku::ScholarshipStatus.create!(name: 'Charity')
14
14
 
15
15
  @john_doe = {
16
16
  name: 'John',
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gaku
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rei Kagetsuki
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2013-10-10 00:00:00.000000000 Z
14
+ date: 2013-10-16 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: gaku_core
@@ -19,28 +19,28 @@ dependencies:
19
19
  requirements:
20
20
  - - '='
21
21
  - !ruby/object:Gem::Version
22
- version: 0.0.2
22
+ version: 0.0.3
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
27
  - - '='
28
28
  - !ruby/object:Gem::Version
29
- version: 0.0.2
29
+ version: 0.0.3
30
30
  - !ruby/object:Gem::Dependency
31
31
  name: gaku_sample
32
32
  requirement: !ruby/object:Gem::Requirement
33
33
  requirements:
34
34
  - - '='
35
35
  - !ruby/object:Gem::Version
36
- version: 0.0.2
36
+ version: 0.0.3
37
37
  type: :runtime
38
38
  prerelease: false
39
39
  version_requirements: !ruby/object:Gem::Requirement
40
40
  requirements:
41
41
  - - '='
42
42
  - !ruby/object:Gem::Version
43
- version: 0.0.2
43
+ version: 0.0.3
44
44
  description: It allows for full student management, grading etc. It's bascally what
45
45
  all student grading tools are with some unique features
46
46
  email: info@genshin.org
@@ -240,7 +240,6 @@ files:
240
240
  - core/app/controllers/gaku/students/class_group_enrollments_controller.rb
241
241
  - core/app/controllers/gaku/students/course_enrollments_controller.rb
242
242
  - core/app/controllers/gaku/students/guardians_controller.rb
243
- - core/app/controllers/gaku/students/importer_controller.rb
244
243
  - core/app/controllers/gaku/students/simple_grades_controller.rb
245
244
  - core/app/controllers/gaku/students/student_achievements_controller.rb
246
245
  - core/app/controllers/gaku/students/student_specialties_controller.rb
@@ -248,7 +247,6 @@ files:
248
247
  - core/app/controllers/gaku/syllabuses/assignments_controller.rb
249
248
  - core/app/controllers/gaku/syllabuses/exam_syllabuses_controller.rb
250
249
  - core/app/controllers/gaku/syllabuses/exams_controller.rb
251
- - core/app/controllers/gaku/syllabuses/importer_controller.rb
252
250
  - core/app/controllers/gaku/syllabuses_controller.rb
253
251
  - core/app/controllers/gaku/teachers_controller.rb
254
252
  - core/app/decorators/gaku/guardian_decorator.rb
@@ -293,6 +291,7 @@ files:
293
291
  - core/app/models/gaku/course_enrollment.rb
294
292
  - core/app/models/gaku/course_group.rb
295
293
  - core/app/models/gaku/course_group_enrollment.rb
294
+ - core/app/models/gaku/disposal.rb
296
295
  - core/app/models/gaku/enrollment_status.rb
297
296
  - core/app/models/gaku/exam.rb
298
297
  - core/app/models/gaku/exam_portion.rb
@@ -308,7 +307,6 @@ files:
308
307
  - core/app/models/gaku/grading_method_set.rb
309
308
  - core/app/models/gaku/grading_method_set_item.rb
310
309
  - core/app/models/gaku/guardian.rb
311
- - core/app/models/gaku/import_file.rb
312
310
  - core/app/models/gaku/install.rb
313
311
  - core/app/models/gaku/lesson.rb
314
312
  - core/app/models/gaku/lesson_plan.rb
@@ -880,6 +878,8 @@ files:
880
878
  - core/app/views/gaku/shared/menu/_global.html.erb
881
879
  - core/app/views/gaku/shared/multi_error.js.erb
882
880
  - core/app/views/gaku/shared/notice.js.erb
881
+ - core/app/views/gaku/shared/overrides/students/_import_link.html.slim
882
+ - core/app/views/gaku/shared/overrides/syllabuses/_import_link.html.slim
883
883
  - core/app/views/gaku/shared/student/_academic.html.slim
884
884
  - core/app/views/gaku/shared/student/_edit.html.slim
885
885
  - core/app/views/gaku/shared/student/_personal.html.slim
@@ -943,8 +943,6 @@ files:
943
943
  - core/app/views/gaku/students/guardians/recovery.js.erb
944
944
  - core/app/views/gaku/students/guardians/show.html.slim
945
945
  - core/app/views/gaku/students/guardians/update.js.erb
946
- - core/app/views/gaku/students/importer/index.html.slim
947
- - core/app/views/gaku/students/importer/roster_import_preview.html.slim
948
946
  - core/app/views/gaku/students/index.html.slim
949
947
  - core/app/views/gaku/students/index.js.erb
950
948
  - core/app/views/gaku/students/index.pdf.thinreports
@@ -1029,7 +1027,6 @@ files:
1029
1027
  - core/app/views/gaku/syllabuses/exams/edit.js.erb
1030
1028
  - core/app/views/gaku/syllabuses/exams/new.js.erb
1031
1029
  - core/app/views/gaku/syllabuses/exams/update.js.erb
1032
- - core/app/views/gaku/syllabuses/importer/index.html.slim
1033
1030
  - core/app/views/gaku/syllabuses/index.html.slim
1034
1031
  - core/app/views/gaku/syllabuses/new.js.erb
1035
1032
  - core/app/views/gaku/syllabuses/update.js.erb
@@ -1061,8 +1058,6 @@ files:
1061
1058
  - core/app/views/kaminari/_page.html.erb
1062
1059
  - core/app/views/kaminari/_paginator.html.erb
1063
1060
  - core/app/views/kaminari/_prev_page.html.erb
1064
- - core/app/workers/gaku/importers/students/roster_worker.rb
1065
- - core/app/workers/gaku/importers/students/school_station_zaikousei_worker.rb
1066
1061
  - core/config/initializers/active_record.rb
1067
1062
  - core/config/initializers/client_side_validations.rb
1068
1063
  - core/config/initializers/devise.rb
@@ -1073,7 +1068,6 @@ files:
1073
1068
  - core/config/initializers/mime_types.rb
1074
1069
  - core/config/initializers/paper_trail.rb
1075
1070
  - core/config/initializers/ruby_template_handler.rb
1076
- - core/config/initializers/sidekiq.rb
1077
1071
  - core/config/initializers/translation_missing.rb
1078
1072
  - core/config/initializers/wrap_parameters.rb
1079
1073
  - core/config/locales/bg.yml
@@ -1091,7 +1085,8 @@ files:
1091
1085
  - core/db/default/gaku/roles.yml
1092
1086
  - core/db/default/gaku/scholarship_statuses.rb
1093
1087
  - core/db/default/gaku/states.yml
1094
- - core/db/migrate/20120202111850_gaku_core.rb
1088
+ - core/db/migrate/20120202111850_translated_tables.rb
1089
+ - core/db/migrate/20131014065028_gaku_core.rb
1095
1090
  - core/db/schema.rb
1096
1091
  - core/db/seeds.rb
1097
1092
  - core/gaku_core.gemspec
@@ -1102,18 +1097,9 @@ files:
1102
1097
  - core/lib/gaku/core/engine.rb
1103
1098
  - core/lib/gaku/core/url_helpers.rb
1104
1099
  - core/lib/gaku/core/version.rb
1105
- - core/lib/gaku/exporters/roster_exporter.rb
1106
1100
  - core/lib/gaku/grading/calculations.rb
1107
1101
  - core/lib/gaku/grading/grade.rb
1108
1102
  - core/lib/gaku/grading/japanese_hs_standard.rb
1109
- - core/lib/gaku/importers/key_mapper.rb
1110
- - core/lib/gaku/importers/logger.rb
1111
- - core/lib/gaku/importers/students/guardians.rb
1112
- - core/lib/gaku/importers/students/personal_information.rb
1113
- - core/lib/gaku/importers/students/roster.rb
1114
- - core/lib/gaku/importers/students/roster_to_student.rb
1115
- - core/lib/gaku/importers/students/school_station_zaikousei.rb
1116
- - core/lib/gaku/importers/students/student_identity.rb
1117
1103
  - core/lib/gaku/testing/auth_helpers.rb
1118
1104
  - core/lib/gaku/testing/common_rake.rb
1119
1105
  - core/lib/gaku/testing/controller_helpers.rb
@@ -1149,7 +1135,6 @@ files:
1149
1135
  - core/lib/gaku/testing/factories/grading_method_set_factory.rb
1150
1136
  - core/lib/gaku/testing/factories/grading_method_set_item_factory.rb
1151
1137
  - core/lib/gaku/testing/factories/guardian_factory.rb
1152
- - core/lib/gaku/testing/factories/import_file_factory.rb
1153
1138
  - core/lib/gaku/testing/factories/lesson_factory.rb
1154
1139
  - core/lib/gaku/testing/factories/lesson_plan_factory.rb
1155
1140
  - core/lib/gaku/testing/factories/level_factory.rb
@@ -1189,11 +1174,8 @@ files:
1189
1174
  - core/lib/generators/gaku/dummy/templates/rails/routes.rb
1190
1175
  - core/lib/generators/gaku/dummy/templates/rails/script/rails
1191
1176
  - core/lib/generators/gaku/install/install_generator.rb
1192
- - core/lib/generators/gaku/install/templates/Procfile
1193
1177
  - core/lib/generators/gaku/install/templates/app/assets/javascripts/gaku/all.js
1194
1178
  - core/lib/generators/gaku/install/templates/app/assets/stylesheets/gaku/all.css
1195
- - core/lib/generators/gaku/install/templates/config/sidekiq.yml
1196
- - core/lib/generators/gaku/install/templates/log/sidekiq.log
1197
1179
  - core/lib/tasks/admin_user.rake
1198
1180
  - core/lib/tasks/core.rake
1199
1181
  - core/lib/tasks/reset.rake
@@ -1230,7 +1212,6 @@ files:
1230
1212
  - core/spec/controllers/gaku/teachers_controller_spec.rb
1231
1213
  - core/spec/coverage/.last_run.json
1232
1214
  - core/spec/coverage/.resultset.json
1233
- - core/spec/integration/importers/roster_spec.rb
1234
1215
  - core/spec/integration/student_address_versioning_spec.rb
1235
1216
  - core/spec/integration/student_contact_vesioning_spec.rb
1236
1217
  - core/spec/integration/student_versioning_spec.rb
@@ -1269,7 +1250,6 @@ files:
1269
1250
  - core/spec/models/grading_method_set_spec.rb
1270
1251
  - core/spec/models/grading_method_spec.rb
1271
1252
  - core/spec/models/guardian_spec.rb
1272
- - core/spec/models/import_file_spec.rb
1273
1253
  - core/spec/models/lesson_plan_spec.rb
1274
1254
  - core/spec/models/lesson_spec.rb
1275
1255
  - core/spec/models/level_spec.rb
@@ -1370,7 +1350,6 @@ files:
1370
1350
  - core/spec/requests/students/guardians/contacts_spec.rb
1371
1351
  - core/spec/requests/students/guardians/guardians_spec.rb
1372
1352
  - core/spec/requests/students/guardians/picture_spec.rb
1373
- - core/spec/requests/students/import_export.rb
1374
1353
  - core/spec/requests/students/notes_spec.rb
1375
1354
  - core/spec/requests/students/picture_spec.rb
1376
1355
  - core/spec/requests/students/scholarship_status_spec.rb
@@ -1397,7 +1376,6 @@ files:
1397
1376
  - core/spec/support/requests/shared_contacts_spec.rb
1398
1377
  - core/spec/support/requests/shared_notes_spec.rb
1399
1378
  - core/spec/support/sample_roster.ods
1400
- - core/spec/support/sample_roster.xls
1401
1379
  - core/spec/support/shared_examples/addressable.rb
1402
1380
  - core/spec/support/shared_examples/allow.rb
1403
1381
  - core/spec/support/shared_examples/avatarable.rb
@@ -1406,7 +1384,6 @@ files:
1406
1384
  - core/spec/support/shared_examples/notable.rb
1407
1385
  - core/spec/support/shared_examples/person.rb
1408
1386
  - core/spec/support/shared_examples/thrashable.rb
1409
- - core/spec/workers/roster_spec.rb
1410
1387
  - core/vendor/assets/javascripts/backbone.js
1411
1388
  - core/vendor/assets/javascripts/tablefix.js.coffee
1412
1389
  - doc/authorized_service_providers/Genshin/genshin_okazaki_office.geojson
@@ -1461,7 +1438,7 @@ requirements:
1461
1438
  - postgres
1462
1439
  - redis
1463
1440
  rubyforge_project:
1464
- rubygems_version: 2.0.3
1441
+ rubygems_version: 2.0.6
1465
1442
  signing_key:
1466
1443
  specification_version: 4
1467
1444
  summary: GAKU is a student/assignment focused student and school management system
@@ -1,75 +0,0 @@
1
- # -*- encoding: utf-8 -*-
2
- require 'GenSheet'
3
- module Gaku
4
- class Students::ImporterController < GakuController
5
-
6
- skip_authorization_check
7
- before_action :load_templates, only: :index
8
-
9
- def index
10
- @importer_types = {I18n.t('student.roster_sheet') => :import_roster, 'School Station' => :import_school_station_zaikousei}
11
- # render 'gaku/students/importer/index'
12
- end
13
-
14
- def get_roster
15
- template = Template.find(params[:template][:id])
16
- #read file from paperclip obejct
17
- source_file = File.new(template.file.path)
18
- #process with GenSheet
19
- sheet = GenSheet.new(source_file).to_xls
20
-
21
- send_file sheet
22
- end
23
-
24
- def get_registration_roster
25
- exporter = Gaku::Exporters::RosterExporter.new
26
- file = exporter.export({})
27
- end
28
-
29
- def create
30
- redirect_to importer_index_path, alert: I18n.t('errors.messages.file_unreadable') && return if params[:importer][:data_file].nil?
31
- file = ImportFile.new(import_params)
32
- file.context = 'students'
33
- raise 'COULD NOT SAVE FILE' unless file.save
34
-
35
- case params[:importer][:importer_type]
36
- when 'import_roster'
37
- import_roster(file)
38
- when 'import_school_station_zaikousei'
39
- import_school_station_zaikousei(file)
40
- end
41
- end
42
-
43
- private
44
-
45
- def import_params
46
- params.require(:importer).permit(:data_file, :importer_type)
47
- end
48
-
49
- def load_templates
50
- @templates ||= Template.all
51
- end
52
-
53
-
54
- def import_roster(file)
55
- if file.data_file.content_type == 'application/vnd.ms-excel' ||
56
- file.data_file.content_type == 'application/vnd.oasis.opendocument.spreadsheet' ||
57
- file.data_file.content_type == 'application/xls'
58
- Gaku::Importers::Students::RosterWorker.perform_async(file.id)
59
- render text: 'Importing Roster'
60
- else
61
- redirect_to importer_index_path, alert: '[' + file.data_file.content_type + '] ' + I18n.t('errors.messages.file_type_unsupported')
62
- end
63
- end
64
-
65
- def import_school_station_zaikousei(file)
66
- if file.data_file.content_type == 'application/vnd.ms-excel'
67
- Gaku::Importers::Students::SchoolStationZaikouseiWorker.perform_async(file.id)
68
- render text: '在校生をSchoolStationからインポート中。'
69
- else
70
- redirect_to importer_index_path, alert: I18n.t('errors.messages.file_type_unsupported')
71
- end
72
- end
73
-
74
- end
75
- end
@@ -1,19 +0,0 @@
1
- # -*- encoding: utf-8 -*-
2
- module Gaku
3
- class Syllabuses::ImporterController < GakuController
4
-
5
- skip_authorization_check
6
-
7
- def index
8
- #@importer_types = ["GAKU Engine"]
9
- render 'gaku/syllabuses/importer/index'
10
- end
11
-
12
- def get_template
13
- end
14
-
15
- def import_from_template
16
- end
17
-
18
- end
19
- end