gaku_sample 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/db/sample/gaku/{01-syllabuses.rb → 01_syllabuses.rb} +8 -10
- data/db/sample/gaku/02_courses.rb +12 -0
- data/db/sample/gaku/20-grading_methods.rb +32 -0
- data/db/sample/gaku/badge_types.rb +3 -7
- data/db/sample/gaku/changes/student_changes.rb +27 -27
- data/db/sample/gaku/class_groups.rb +3 -3
- data/db/sample/gaku/disposals/address_and_contact_disposals.rb +1 -1
- data/db/sample/gaku/disposals/attachment_disposals.rb +15 -7
- data/db/sample/gaku/disposals/course_group_disposals.rb +6 -6
- data/db/sample/gaku/disposals/exam_disposals.rb +6 -6
- data/db/sample/gaku/disposals/student_disposals.rb +8 -8
- data/db/sample/gaku/disposals/teacher_disposals.rb +6 -6
- data/db/sample/gaku/exams.rb +1 -4
- data/db/sample/gaku/extracurricular_activities.rb +1 -4
- data/db/sample/gaku/grading_widget.rb +7 -13
- data/db/sample/gaku/roles.rb +2 -5
- data/db/sample/gaku/schools.rb +22 -0
- data/db/sample/gaku/specialties.rb +2 -8
- data/db/sample/gaku/students.rb +6 -8
- data/db/sample/gaku/teachers.rb +5 -12
- data/db/sample/gaku/users.rb +2 -3
- data/lib/shared_sample_data.rb +35 -24
- metadata +38 -33
- data/db/sample/gaku/02-courses.rb +0 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 03f2a76a685a9d1a715fbfb59321d483e5140b5a
|
4
|
+
data.tar.gz: c2cc958128bffb1fca443482e7f8632d55a526f5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7f532d9f85b1e64ba83d9d82831f68af4cd1f616ad088d9c4b47863337e08e9d8366b184f1d343cde11031661f6d0994478fe61ba2758272aac556b4a59be743
|
7
|
+
data.tar.gz: a4b4f34d9f6b06bda2dcf7cda74a374352b86cf8c43f778ee64c0cc1a49188867125225b75a07cbb9b640366d9fcf1a730f3438ecaea397ad0780098cc3fcf84
|
@@ -1,7 +1,4 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
1
|
syllabuses = [
|
4
|
-
|
5
2
|
{
|
6
3
|
name: 'Introduction to Biology',
|
7
4
|
code: 'B01',
|
@@ -19,21 +16,25 @@ syllabuses = [
|
|
19
16
|
{
|
20
17
|
name: 'Literature',
|
21
18
|
code: 'LIT',
|
22
|
-
description: 'In this course you will read a series of short stories and essays
|
19
|
+
description: 'In this course you will read a series of short stories and essays
|
20
|
+
by stuck up self-proclaimed writers.',
|
23
21
|
credits: 1
|
24
22
|
},
|
25
23
|
|
26
24
|
{
|
27
25
|
name: 'Introductory Japanese[日本語入門]',
|
28
26
|
code: 'NH1',
|
29
|
-
description: 'Learn basic moonspeak. This course covers introductions,
|
27
|
+
description: 'Learn basic moonspeak. This course covers introductions,
|
28
|
+
greetings and basic questions and answers for every day life.
|
29
|
+
This course also covers both sets of kana and some basic kanji.',
|
30
30
|
credits: 2
|
31
31
|
},
|
32
32
|
|
33
33
|
{
|
34
34
|
name: 'ブルガリア語入門',
|
35
35
|
code: 'BG1',
|
36
|
-
description: '
|
36
|
+
description: 'ブルガリアで日常生活が出来る様、挨拶や日常に使う質問と答えの仕方が学べます。
|
37
|
+
ブルガリア語に使われるキリル文字の読み書きも出来る様になります。',
|
37
38
|
credits: 2
|
38
39
|
},
|
39
40
|
|
@@ -124,7 +125,4 @@ syllabuses = [
|
|
124
125
|
]
|
125
126
|
|
126
127
|
say "Creating #{syllabuses.size} syllabuses ...".yellow
|
127
|
-
|
128
|
-
syllabuses.each do |syllabus|
|
129
|
-
Gaku::Syllabus.where(syllabus).first_or_create!
|
130
|
-
end
|
128
|
+
syllabuses.each { |syllabus| Gaku::Syllabus.where(syllabus).first_or_create! }
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
courses = [
|
4
|
+
{ syllabus: Gaku::Syllabus.where(code: 'B01').first, code: 'Spring 2013' },
|
5
|
+
{ syllabus: Gaku::Syllabus.where(code: 'MT').first, code: '2013年(秋)' },
|
6
|
+
{ syllabus: Gaku::Syllabus.where(code: 'RB1').first, code: 'Prof. Why' }
|
7
|
+
]
|
8
|
+
|
9
|
+
say "Creating #{courses.size} courses ...".yellow
|
10
|
+
courses.each do |course|
|
11
|
+
Gaku::Course.where(code: course[:code], syllabus_id: course[:syllabus]).first_or_create!
|
12
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
grading_methods = [
|
2
|
+
{
|
3
|
+
name: 'Score',
|
4
|
+
grading_type: 'score',
|
5
|
+
description: 'Straight Score',
|
6
|
+
curved: false
|
7
|
+
},
|
8
|
+
{
|
9
|
+
name: 'Curved Score',
|
10
|
+
grading_type: 'score',
|
11
|
+
description: 'Curved Score',
|
12
|
+
curved: true
|
13
|
+
},
|
14
|
+
{
|
15
|
+
name: 'Percentage',
|
16
|
+
grading_type: 'percentage',
|
17
|
+
description: 'Straight Percentage',
|
18
|
+
curved: false
|
19
|
+
},
|
20
|
+
{
|
21
|
+
name: 'Curved Percentage',
|
22
|
+
grading_type: 'percentage',
|
23
|
+
description: 'Curved Percentage',
|
24
|
+
curved: true
|
25
|
+
}
|
26
|
+
]
|
27
|
+
|
28
|
+
say "Creating #{grading_methods.size} grading methods ...".yellow
|
29
|
+
|
30
|
+
grading_methods.each do |grading_method|
|
31
|
+
Gaku::GradingMethod.where(grading_method).first_or_create!
|
32
|
+
end
|
@@ -1,12 +1,8 @@
|
|
1
|
-
els = %w(
|
2
|
-
JuniorRuby SeniorRuby RubyGuru
|
1
|
+
els = %w( JuniorRuby SeniorRuby RubyGuru
|
3
2
|
JuniorJavascript SeniorJavascript JavascriptGuru
|
4
3
|
JuniorClojure SeniorClojure ClojureGuru
|
5
|
-
JuniorScala SeniorScala ScalaGuru
|
6
|
-
)
|
4
|
+
JuniorScala SeniorScala ScalaGuru )
|
7
5
|
|
8
6
|
say "Creating #{els.size} badges ...".yellow
|
9
7
|
|
10
|
-
els.each
|
11
|
-
Gaku::BadgeType.where(name: el).first_or_create!
|
12
|
-
end
|
8
|
+
els.each { |el| Gaku::BadgeType.where(name: el).first_or_create! }
|
@@ -1,33 +1,33 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
require 'shared_sample_data'
|
1
|
+
# # encoding: utf-8
|
2
|
+
# require 'shared_sample_data'
|
3
3
|
|
4
|
-
say "Creating #{@count[:changes]} student changes ...".yellow
|
4
|
+
# say "Creating #{@count[:changes]} student changes ...".yellow
|
5
5
|
|
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')
|
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
|
-
counter = 0
|
10
|
+
# counter = 0
|
11
11
|
|
12
|
-
batch_create(@count[:changes]) do
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
12
|
+
# batch_create(@count[:changes]) do
|
13
|
+
# counter += 1
|
14
|
+
# random_student = random_person.merge(
|
15
|
+
# commute_method_type: @commute_method_type,
|
16
|
+
# enrollment_status_code: @enrollment_status,
|
17
|
+
# scholarship_status: @scholarship_status,
|
18
|
+
# foreign_id_code: "foreign_id_code_#{counter}"
|
19
|
+
# )
|
20
20
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
21
|
+
# student = Gaku::Student.where(random_student).first_or_create!
|
22
|
+
# student.name = Faker::Name.first_name
|
23
|
+
# student.middle_name = Faker::Name.first_name
|
24
|
+
# student.surname = Faker::Name.last_name
|
25
|
+
# student.enrollment_status_code = enrollment_status.code
|
26
|
+
# student.commute_method_type = commute_method_type
|
27
|
+
# student.scholarship_status = scholarship_status
|
28
|
+
# student.foreign_id_code = "foreign_code_#{counter + 100}"
|
29
|
+
# student.save!
|
30
30
|
|
31
|
-
|
32
|
-
|
33
|
-
end
|
31
|
+
# student.soft_delete
|
32
|
+
# student.destroy
|
33
|
+
# end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
|
-
|
3
|
+
Gaku::SchoolYear.where(starting: Time.now - 3.months, ending: Time.now + 9.months).first_or_create!
|
4
4
|
active_semester = Gaku::Semester.where(starting: Time.now - 2.months, ending: Time.now + 2.months).first_or_create!
|
5
5
|
not_active_semester = Gaku::Semester.where(starting: Time.now + 3.months, ending: Time.now + 9.months).first_or_create!
|
6
6
|
|
@@ -28,5 +28,5 @@ end
|
|
28
28
|
active_class_group = Gaku::ClassGroup.where(name: 'Mr.Kalkov').first
|
29
29
|
not_active_class_group = Gaku::ClassGroup.where(name: 'Mr.Kagetsuki').first
|
30
30
|
|
31
|
-
Gaku::
|
32
|
-
Gaku::
|
31
|
+
Gaku::SemesterConnector.where(semesterable_id: active_class_group.id, semesterable_type: 'Gaku::ClassGroup', semester_id: active_semester.id).first_or_create!
|
32
|
+
Gaku::SemesterConnector.where(semesterable_id: not_active_class_group.id, semesterable_type: 'Gaku::ClassGroup', semester_id: not_active_semester.id).first_or_create!
|
@@ -1,9 +1,17 @@
|
|
1
|
-
require 'shared_sample_data'
|
1
|
+
# require 'shared_sample_data'
|
2
2
|
|
3
|
-
say "Creating #{@count[:disposals]} exam attachment disposals ...".yellow
|
3
|
+
# say "Creating #{@count[:disposals]} exam attachment disposals ...".yellow
|
4
4
|
|
5
|
-
batch_create(@count[:disposals]) do
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
5
|
+
# batch_create(@count[:disposals]) do
|
6
|
+
# exam = Gaku::Exam.where(name: "#{Faker::Education.major} Exam").first_or_create!
|
7
|
+
# exam_portion = exam.exam_portions.where(
|
8
|
+
# name: "#{Faker::Education.major} ExamPortion",
|
9
|
+
# max_score: 100
|
10
|
+
# ).first_or_create!
|
11
|
+
# Gaku::Attachment.create!(
|
12
|
+
# name: 'Attachment Name',
|
13
|
+
# attachable: exam_portion,
|
14
|
+
# asset: File.open(File.join(File.dirname(__FILE__), '..', 'images', '120x120.jpg')),
|
15
|
+
# deleted: true
|
16
|
+
# )
|
17
|
+
# end
|
@@ -1,8 +1,8 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
require 'shared_sample_data'
|
1
|
+
# # encoding: utf-8
|
2
|
+
# require 'shared_sample_data'
|
3
3
|
|
4
|
-
say "Creating #{@count[:disposals]} course groups ...".yellow
|
4
|
+
# say "Creating #{@count[:disposals]} course groups ...".yellow
|
5
5
|
|
6
|
-
batch_create(@count[:disposals]) do
|
7
|
-
|
8
|
-
end
|
6
|
+
# batch_create(@count[:disposals]) do
|
7
|
+
# Gaku::CourseGroup.where(name: "#{Faker::Education.major} CourseGroup", deleted: true).first_or_create!
|
8
|
+
# end
|
@@ -1,8 +1,8 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
require 'shared_sample_data'
|
1
|
+
# # encoding: utf-8
|
2
|
+
# require 'shared_sample_data'
|
3
3
|
|
4
|
-
say "Creating #{@count[:disposals]} exams ...".yellow
|
4
|
+
# say "Creating #{@count[:disposals]} exams ...".yellow
|
5
5
|
|
6
|
-
batch_create(@count[:disposals]) do
|
7
|
-
|
8
|
-
end
|
6
|
+
# batch_create(@count[:disposals]) do
|
7
|
+
# Gaku::Exam.where(name: Faker::Education.major, deleted: true).first_or_create!
|
8
|
+
# end
|
@@ -1,10 +1,10 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
require 'shared_sample_data'
|
1
|
+
# # encoding: utf-8
|
2
|
+
# require 'shared_sample_data'
|
3
3
|
|
4
|
-
say "Creating #{@count[:disposals]} students and guardians ...".yellow
|
4
|
+
# say "Creating #{@count[:disposals]} students and guardians ...".yellow
|
5
5
|
|
6
|
-
batch_create(@count[:disposals]) do
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
end
|
6
|
+
# batch_create(@count[:disposals]) do
|
7
|
+
# student = Gaku::Student.where(random_person.merge(deleted: true)).first_or_create!
|
8
|
+
# guardian = Gaku::Guardian.where(random_person.merge(deleted: true)).first_or_create!
|
9
|
+
# student.guardians << guardian
|
10
|
+
# end
|
@@ -1,8 +1,8 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
require 'shared_sample_data'
|
1
|
+
# # encoding: utf-8
|
2
|
+
# require 'shared_sample_data'
|
3
3
|
|
4
|
-
say "Creating #{@count[:disposals]} teachers ...".yellow
|
4
|
+
# say "Creating #{@count[:disposals]} teachers ...".yellow
|
5
5
|
|
6
|
-
batch_create(@count[:disposals]) do
|
7
|
-
|
8
|
-
end
|
6
|
+
# batch_create(@count[:disposals]) do
|
7
|
+
# Gaku::Teacher.where(random_person.merge(deleted: true)).first_or_create!
|
8
|
+
# end
|
data/db/sample/gaku/exams.rb
CHANGED
@@ -1,7 +1,4 @@
|
|
1
1
|
els = %w( Tennis Football Basketball Handball Climbing Running Swimming Rugby PingPong Chess Fitness )
|
2
2
|
|
3
3
|
say "Creating #{els.size} extracurricular activities ...".yellow
|
4
|
-
|
5
|
-
els.each do |el|
|
6
|
-
Gaku::ExtracurricularActivity.where(name: el).first_or_create!
|
7
|
-
end
|
4
|
+
els.each { |el| Gaku::ExtracurricularActivity.where(name: el).first_or_create! }
|
@@ -5,27 +5,21 @@ say 'Creating grading widget data ...'.yellow
|
|
5
5
|
|
6
6
|
syllabus = Gaku::Syllabus.where(name: 'Ruby', code: 'rb').first_or_create!
|
7
7
|
course = Gaku::Course.where(code: 'Fall 2011').first_or_create!
|
8
|
-
|
8
|
+
Gaku::EnrollmentStatus.where(code: 'admitted').first.try(:code)
|
9
9
|
|
10
10
|
student = Gaku::Student.where(@john_doe).first_or_create!
|
11
11
|
|
12
12
|
exam1 = Gaku::Exam.where(name: 'Midterm', use_weighting: true, weight: 4).first_or_create!
|
13
|
-
|
14
|
-
|
13
|
+
exam1.exam_portions.create(name: 'Multiple Choice', max_score: 100)
|
14
|
+
exam1.exam_portions.create(name: 'Practical', max_score: 200)
|
15
15
|
|
16
16
|
exam2 = Gaku::Exam.where(name: 'Final', use_weighting: true, weight: 6).first_or_create!
|
17
|
-
|
18
|
-
|
17
|
+
exam2.exam_portions.where(name: 'Question and Answer', max_score: 200).first_or_create!
|
18
|
+
exam2.exam_portions.where(name: 'Practical', max_score: 300).first_or_create!
|
19
19
|
|
20
20
|
exams = [exam1, exam2]
|
21
21
|
|
22
|
-
unless syllabus.exams.count > 0
|
23
|
-
|
24
|
-
end
|
25
|
-
|
26
|
-
unless course.students.count > 0
|
27
|
-
course.students << student
|
28
|
-
end
|
22
|
+
syllabus.exams << exams unless syllabus.exams.count > 0
|
23
|
+
course.students << student unless course.students.count > 0
|
29
24
|
|
30
25
|
syllabus.courses << course
|
31
|
-
|
data/db/sample/gaku/roles.rb
CHANGED
@@ -1,9 +1,6 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
|
-
roles = %w(Admin ProgramManager Instructor Counselor Staff Principal VicePrincipal Student Guardian)
|
3
|
+
roles = %w( Admin ProgramManager Instructor Counselor Staff Principal VicePrincipal Student Guardian )
|
4
4
|
|
5
5
|
say "Creating #{roles.size} roles ...".yellow
|
6
|
-
|
7
|
-
roles.each do |role|
|
8
|
-
Gaku::Role.where(name: role).first_or_create!
|
9
|
-
end
|
6
|
+
roles.each { |role| Gaku::Role.where(name: role).first_or_create! }
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'shared_sample_data'
|
2
|
+
|
3
|
+
school = Gaku::School.where(
|
4
|
+
name: 'Test School',
|
5
|
+
slogan: 'Test School Slogan',
|
6
|
+
founded: Time.now,
|
7
|
+
principal: 'Test School Principal',
|
8
|
+
vice_principal: 'Test School Vice Principal'
|
9
|
+
).first_or_create!
|
10
|
+
|
11
|
+
campus1 = school.campuses.where(name: 'Biology Campus').first_or_create!
|
12
|
+
campus2 = school.campuses.where(name: 'Informatics Campus').first_or_create!
|
13
|
+
|
14
|
+
campus1.address = Gaku::Address.where(random_address.merge(addressable: campus1)).first_or_create!
|
15
|
+
campus1.contacts.where(random_email).first_or_create!
|
16
|
+
campus1.contacts.where(random_home_phone).first_or_create!
|
17
|
+
campus1.contacts.where(random_mobile_phone).first_or_create!
|
18
|
+
|
19
|
+
campus2.address = Gaku::Address.where(random_address.merge(addressable: campus2)).first_or_create!
|
20
|
+
campus2.contacts.where(random_email).first_or_create!
|
21
|
+
campus2.contacts.where(random_home_phone).first_or_create!
|
22
|
+
campus2.contacts.where(random_mobile_phone).first_or_create!
|
@@ -1,10 +1,4 @@
|
|
1
|
-
els = %w(
|
2
|
-
RubyDeveloper JavascriptDeveloper ClojureDeveloper
|
3
|
-
ScalaDeveloper PythonDeveloper GoDeveloper
|
4
|
-
)
|
1
|
+
els = %w( RubyDeveloper JavascriptDeveloper ClojureDeveloper ScalaDeveloper PythonDeveloper GoDeveloper )
|
5
2
|
|
6
3
|
say "Creating #{els.size} specialties ...".yellow
|
7
|
-
|
8
|
-
els.each do |el|
|
9
|
-
Gaku::Specialty.where(name: el).first_or_create!
|
10
|
-
end
|
4
|
+
els.each { |el| Gaku::Specialty.where(name: el).first_or_create! }
|
data/db/sample/gaku/students.rb
CHANGED
@@ -3,20 +3,18 @@ require 'shared_sample_data'
|
|
3
3
|
|
4
4
|
say 'Creating predefined students ...'.yellow
|
5
5
|
students = [
|
6
|
-
{ name: 'Anonime', surname: '
|
7
|
-
{ name: 'Amon', surname: 'Tobin', birth_date: Date.new(1983,1,1), enrollment_status_code: @enrollment_status },
|
6
|
+
{ name: 'Anonime', surname: 'Anon', birth_date: Date.new(1982, 1, 1), enrollment_status_code: @enrollment_status },
|
7
|
+
{ name: 'Amon', surname: 'Tobin', birth_date: Date.new(1983, 1, 1), enrollment_status_code: @enrollment_status },
|
8
8
|
{ name: '零', surname: '影月', enrollment_status_code: @enrollment_status },
|
9
9
|
{ name: 'サニー', surname: 'スノー', enrollment_status_code: @enrollment_status }
|
10
10
|
]
|
11
11
|
|
12
12
|
create_student_with_full_info(@john_doe)
|
13
|
-
students.each do |student|
|
14
|
-
create_student_with_full_info(student)
|
15
|
-
end
|
16
13
|
|
14
|
+
students.each { |student| create_student_with_full_info(student) }
|
17
15
|
|
18
16
|
say "Creating #{@count[:students]} students ...".yellow
|
17
|
+
batch_create(@count[:students]) { create_student_with_full_info }
|
19
18
|
|
20
|
-
|
21
|
-
|
22
|
-
end
|
19
|
+
say "Creating #{@count[:students]} applicant students ...".yellow
|
20
|
+
batch_create(@count[:students]) { create_non_active_student }
|
data/db/sample/gaku/teachers.rb
CHANGED
@@ -4,20 +4,13 @@ require 'shared_sample_data'
|
|
4
4
|
teachers = [
|
5
5
|
{ name: 'Vassil', surname: 'Kalkov' },
|
6
6
|
{ name: 'Marta', surname: 'Kostova' },
|
7
|
-
{ name: 'Georgi', surname: 'Tapalilov'},
|
8
|
-
{ name: 'Radoslav', surname: 'Georgiev'},
|
9
|
-
{ name: 'Rei', surname: 'Kagetsuki'}
|
7
|
+
{ name: 'Georgi', surname: 'Tapalilov' },
|
8
|
+
{ name: 'Radoslav', surname: 'Georgiev' },
|
9
|
+
{ name: 'Rei', surname: 'Kagetsuki' }
|
10
10
|
]
|
11
11
|
|
12
12
|
say 'Creating predefined teachers...'.yellow
|
13
|
-
|
14
|
-
teachers.each do |teacher|
|
15
|
-
create_teacher_with_full_info(teacher)
|
16
|
-
end
|
17
|
-
|
13
|
+
teachers.each { |teacher| create_teacher_with_full_info(teacher) }
|
18
14
|
|
19
15
|
say "Creating #{@count[:teachers]} teachers...".yellow
|
20
|
-
|
21
|
-
batch_create(@count[:teachers]) do
|
22
|
-
create_teacher_with_full_info
|
23
|
-
end
|
16
|
+
batch_create(@count[:teachers]) { create_teacher_with_full_info }
|
data/db/sample/gaku/users.rb
CHANGED
@@ -52,8 +52,7 @@ guardian_role = Gaku::Role.find_by_name('Guardian')
|
|
52
52
|
guardian_user.roles << guardian_role
|
53
53
|
|
54
54
|
say "Creating #{@count[:users]} users...".yellow
|
55
|
-
|
56
55
|
batch_create(@count[:teachers]) do
|
57
|
-
Gaku::User.where(username: Faker::Name.first_name, email: Faker::Internet.email)
|
56
|
+
Gaku::User.where(username: Faker::Name.first_name, email: Faker::Internet.email)
|
57
|
+
.first_or_create(password: '123456', password_confirmation: '123456')
|
58
58
|
end
|
59
|
-
|
data/lib/shared_sample_data.rb
CHANGED
@@ -1,8 +1,9 @@
|
|
1
|
-
@country = Gaku::Country.where(
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
1
|
+
@country = Gaku::Country.where(
|
2
|
+
name: '日本',
|
3
|
+
iso3: 'JPN',
|
4
|
+
iso: 'JP',
|
5
|
+
iso_name: 'JAPAN',
|
6
|
+
numcode: '392'
|
6
7
|
).first_or_create!
|
7
8
|
|
8
9
|
@state = Gaku::State.where(name: Faker::Address.us_state, country_iso: @country.iso).first_or_create!
|
@@ -11,13 +12,14 @@
|
|
11
12
|
@home_phone = Gaku::ContactType.where(name: 'Home Phone').first_or_create!
|
12
13
|
@email = Gaku::ContactType.where(name: 'Email').first_or_create!
|
13
14
|
@enrollment_status = Gaku::EnrollmentStatus.where(code: 'admitted').first.try(:code)
|
15
|
+
@enrollment_status_applicant = Gaku::EnrollmentStatus.where(code: 'applicant').first.try(:code)
|
14
16
|
@commute_method_type = Gaku::CommuteMethodType.create!(name: 'Superbike')
|
15
17
|
@scholarship_status = Gaku::ScholarshipStatus.create!(name: 'Charity')
|
16
18
|
|
17
19
|
@john_doe = {
|
18
20
|
name: 'John',
|
19
21
|
surname: 'Doe',
|
20
|
-
birth_date: Date.new(1983,10,5),
|
22
|
+
birth_date: Date.new(1983, 10, 5),
|
21
23
|
enrollment_status_code: @enrollment_status
|
22
24
|
}
|
23
25
|
|
@@ -41,11 +43,10 @@ def random_person
|
|
41
43
|
name: Faker::Name.first_name,
|
42
44
|
middle_name: Faker::Name.first_name,
|
43
45
|
surname: Faker::Name.last_name,
|
44
|
-
birth_date: Date.today-rand(1000)
|
46
|
+
birth_date: Date.today - rand(1000)
|
45
47
|
}
|
46
48
|
end
|
47
49
|
|
48
|
-
|
49
50
|
def random_home_phone
|
50
51
|
{
|
51
52
|
data: Faker::PhoneNumber.phone_number,
|
@@ -74,7 +75,6 @@ def random_note
|
|
74
75
|
}
|
75
76
|
end
|
76
77
|
|
77
|
-
|
78
78
|
def random_address
|
79
79
|
{
|
80
80
|
address1: Faker::Address.street_address,
|
@@ -87,7 +87,7 @@ def random_address
|
|
87
87
|
}
|
88
88
|
end
|
89
89
|
|
90
|
-
def create_student_with_full_info(predefined_student=nil)
|
90
|
+
def create_student_with_full_info(predefined_student = nil)
|
91
91
|
if predefined_student
|
92
92
|
student = Gaku::Student.where(predefined_student).first_or_create!
|
93
93
|
else
|
@@ -96,25 +96,34 @@ def create_student_with_full_info(predefined_student=nil)
|
|
96
96
|
end
|
97
97
|
|
98
98
|
student.addresses.where(random_address).first_or_create!
|
99
|
-
|
100
|
-
|
101
|
-
|
99
|
+
|
100
|
+
[random_email, random_home_phone, random_mobile_phone].each do |params|
|
101
|
+
Gaku::ContactCreation.new(params.merge(contactable: student)).save!
|
102
|
+
end
|
103
|
+
|
102
104
|
student.notes.where(random_note).first_or_create!
|
103
105
|
student.notes.where(random_note).first_or_create!
|
104
106
|
|
105
|
-
#guardian
|
106
107
|
guardian = Gaku::Guardian.where(random_person).first_or_create!
|
107
108
|
guardian.addresses.where(random_address).first_or_create!
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
#guardian.notes.where(random_note).first_or_create!
|
109
|
+
|
110
|
+
[random_email, random_home_phone, random_mobile_phone].each do |params|
|
111
|
+
Gaku::ContactCreation.new(params.merge(contactable: guardian)).save!
|
112
|
+
end
|
113
113
|
|
114
114
|
student.guardians << guardian
|
115
115
|
end
|
116
116
|
|
117
|
-
def
|
117
|
+
def create_non_active_student(predefined_student = nil)
|
118
|
+
if predefined_student
|
119
|
+
Gaku::Student.where(predefined_student).first_or_create!
|
120
|
+
else
|
121
|
+
random_student = random_person.merge(enrollment_status_code: @enrollment_status_applicant)
|
122
|
+
Gaku::Student.where(random_student).first_or_create!
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
126
|
+
def create_teacher_with_full_info(predefined_teacher = nil)
|
118
127
|
if predefined_teacher
|
119
128
|
teacher = Gaku::Teacher.where(predefined_teacher).first_or_create!
|
120
129
|
else
|
@@ -123,9 +132,11 @@ def create_teacher_with_full_info(predefined_teacher=nil)
|
|
123
132
|
end
|
124
133
|
|
125
134
|
teacher.addresses.create!(random_address)
|
126
|
-
|
127
|
-
|
128
|
-
|
135
|
+
|
136
|
+
[random_email, random_home_phone, random_mobile_phone].each do |params|
|
137
|
+
Gaku::ContactCreation.new(params.merge(contactable: teacher)).save!
|
138
|
+
end
|
139
|
+
|
129
140
|
teacher.notes.create!(random_note)
|
130
141
|
teacher.notes.create!(random_note)
|
131
|
-
end
|
142
|
+
end
|
metadata
CHANGED
@@ -1,16 +1,17 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gaku_sample
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rei Kagetsuki
|
8
|
-
- Vassil Kalkov
|
9
8
|
- Georgi Tapalilov
|
9
|
+
- Nakaya Yukiharu
|
10
|
+
- Vassil Kalkov
|
10
11
|
autorequire:
|
11
12
|
bindir: bin
|
12
13
|
cert_chain: []
|
13
|
-
date:
|
14
|
+
date: 2015-02-15 00:00:00.000000000 Z
|
14
15
|
dependencies:
|
15
16
|
- !ruby/object:Gem::Dependency
|
16
17
|
name: gaku_core
|
@@ -18,47 +19,51 @@ dependencies:
|
|
18
19
|
requirements:
|
19
20
|
- - '='
|
20
21
|
- !ruby/object:Gem::Version
|
21
|
-
version: 0.
|
22
|
+
version: 0.2.0
|
22
23
|
type: :runtime
|
23
24
|
prerelease: false
|
24
25
|
version_requirements: !ruby/object:Gem::Requirement
|
25
26
|
requirements:
|
26
27
|
- - '='
|
27
28
|
- !ruby/object:Gem::Version
|
28
|
-
version: 0.
|
29
|
+
version: 0.2.0
|
29
30
|
description: Just some sample data
|
30
|
-
email: info@
|
31
|
+
email: info@gakuengine.com
|
31
32
|
executables: []
|
32
33
|
extensions: []
|
33
34
|
extra_rdoc_files: []
|
34
35
|
files:
|
35
|
-
-
|
36
|
-
-
|
37
|
-
-
|
38
|
-
- lib/sample_counters.rb
|
39
|
-
- db/sample/gaku/grading_widget.rb
|
40
|
-
- db/sample/gaku/users.rb
|
41
|
-
- db/sample/gaku/disposals/teacher_disposals.rb
|
42
|
-
- db/sample/gaku/disposals/student_disposals.rb
|
43
|
-
- db/sample/gaku/disposals/exam_disposals.rb
|
44
|
-
- db/sample/gaku/disposals/attachment_disposals.rb
|
45
|
-
- db/sample/gaku/disposals/address_and_contact_disposals.rb
|
46
|
-
- db/sample/gaku/disposals/course_group_disposals.rb
|
47
|
-
- db/sample/gaku/course_groups.rb
|
48
|
-
- db/sample/gaku/changes/student_changes.rb
|
49
|
-
- db/sample/gaku/specialties.rb
|
36
|
+
- db/sample/gaku/01_syllabuses.rb
|
37
|
+
- db/sample/gaku/02_courses.rb
|
38
|
+
- db/sample/gaku/20-grading_methods.rb
|
50
39
|
- db/sample/gaku/badge_types.rb
|
40
|
+
- db/sample/gaku/changes/student_changes.rb
|
51
41
|
- db/sample/gaku/class_groups.rb
|
52
|
-
- db/sample/gaku/
|
53
|
-
- db/sample/gaku/
|
54
|
-
- db/sample/gaku/
|
55
|
-
- db/sample/gaku/
|
42
|
+
- db/sample/gaku/course_groups.rb
|
43
|
+
- db/sample/gaku/disposals/address_and_contact_disposals.rb
|
44
|
+
- db/sample/gaku/disposals/attachment_disposals.rb
|
45
|
+
- db/sample/gaku/disposals/course_group_disposals.rb
|
46
|
+
- db/sample/gaku/disposals/exam_disposals.rb
|
47
|
+
- db/sample/gaku/disposals/student_disposals.rb
|
48
|
+
- db/sample/gaku/disposals/teacher_disposals.rb
|
56
49
|
- db/sample/gaku/exams.rb
|
57
|
-
- db/sample/gaku/
|
50
|
+
- db/sample/gaku/extracurricular_activities.rb
|
51
|
+
- db/sample/gaku/grading_widget.rb
|
52
|
+
- db/sample/gaku/images/120x120.jpg
|
58
53
|
- db/sample/gaku/roles.rb
|
59
|
-
- db/sample/gaku/
|
60
|
-
|
61
|
-
|
54
|
+
- db/sample/gaku/schools.rb
|
55
|
+
- db/sample/gaku/specialties.rb
|
56
|
+
- db/sample/gaku/students.rb
|
57
|
+
- db/sample/gaku/teachers.rb
|
58
|
+
- db/sample/gaku/users.rb
|
59
|
+
- lib/gaku_sample.rb
|
60
|
+
- lib/sample_counters.rb
|
61
|
+
- lib/shared_sample_data.rb
|
62
|
+
- lib/tasks/sample.rake
|
63
|
+
homepage: http://www.gakuengine.com
|
64
|
+
licenses:
|
65
|
+
- GPL-3.0
|
66
|
+
- AGPL-3.0
|
62
67
|
metadata: {}
|
63
68
|
post_install_message:
|
64
69
|
rdoc_options: []
|
@@ -66,19 +71,19 @@ require_paths:
|
|
66
71
|
- lib
|
67
72
|
required_ruby_version: !ruby/object:Gem::Requirement
|
68
73
|
requirements:
|
69
|
-
- -
|
74
|
+
- - ">="
|
70
75
|
- !ruby/object:Gem::Version
|
71
|
-
version: 2.
|
76
|
+
version: 2.1.3
|
72
77
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
73
78
|
requirements:
|
74
|
-
- -
|
79
|
+
- - ">="
|
75
80
|
- !ruby/object:Gem::Version
|
76
81
|
version: '0'
|
77
82
|
requirements:
|
78
83
|
- postgresql
|
79
84
|
- postgresql-contrib
|
80
85
|
rubyforge_project:
|
81
|
-
rubygems_version: 2.
|
86
|
+
rubygems_version: 2.4.5
|
82
87
|
signing_key:
|
83
88
|
specification_version: 4
|
84
89
|
summary: Sample data for use with GAKU Engine
|
@@ -1,13 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
courses = [
|
4
|
-
{syllabus: Gaku::Syllabus.where(code: 'B01').first, code: "Spring 2013"},
|
5
|
-
{syllabus: Gaku::Syllabus.where(code: 'MT').first, code: "2013年(秋)"},
|
6
|
-
{syllabus: Gaku::Syllabus.where(code: 'RB1').first, code: "Prof. Why"}
|
7
|
-
]
|
8
|
-
|
9
|
-
say "Creating #{courses.size} courses ...".yellow
|
10
|
-
|
11
|
-
courses.each do |course|
|
12
|
-
Gaku::Course.where(code: course[:code], syllabus_id: course[:syllabus]).first_or_create!
|
13
|
-
end
|