gaku_sample 0.0.3 → 0.1.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/{syllabuses.rb → 01-syllabuses.rb} +18 -18
- data/db/sample/gaku/02-courses.rb +13 -0
- data/db/sample/gaku/{achievements.rb → badge_types.rb} +2 -2
- data/db/sample/gaku/changes/student_changes.rb +2 -4
- data/db/sample/gaku/class_groups.rb +10 -0
- data/db/sample/gaku/disposals/address_and_contact_disposals.rb +20 -20
- data/db/sample/gaku/teachers.rb +3 -11
- data/lib/shared_sample_data.rb +29 -6
- metadata +23 -23
- data/db/sample/gaku/courses.rb +0 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7e88f074dc022b50d80c9c34b551fcb01cf3050d
|
4
|
+
data.tar.gz: 41634ba2d11041fa58f5d4103ea7f4bc7575af1b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 81dbd99891ca53b84ae5573e54de37d9c90ee107ab991c22bfcb2b067c17dfa87452b9327fe518181c6e5d72e7e276b51cbaede07fbfbe9c6d5887d1929de616
|
7
|
+
data.tar.gz: 436de5be38a3b4076b32ecc73fb467a66100a32ccabb06f6b240a54da3dbf65f84425db533d8ac1a85c8ee0394bf9d00fbf773e38f716c397c566b40b069c931
|
@@ -2,119 +2,119 @@
|
|
2
2
|
|
3
3
|
syllabuses = [
|
4
4
|
|
5
|
-
|
5
|
+
{
|
6
6
|
name: 'Introduction to Biology',
|
7
7
|
code: 'B01',
|
8
8
|
description: 'A general introduction to the world of organisms and how they function',
|
9
9
|
credits: 5
|
10
10
|
},
|
11
11
|
|
12
|
-
|
12
|
+
{
|
13
13
|
name: 'Trigonometry',
|
14
14
|
code: 'M401',
|
15
15
|
description: 'TRIANGLES!',
|
16
16
|
credits: 3
|
17
17
|
},
|
18
18
|
|
19
|
-
|
19
|
+
{
|
20
20
|
name: 'Literature',
|
21
21
|
code: 'LIT',
|
22
22
|
description: 'In this course you will read a series of short stories and essays by stuck up self-proclaimed writers.',
|
23
23
|
credits: 1
|
24
24
|
},
|
25
25
|
|
26
|
-
|
26
|
+
{
|
27
27
|
name: 'Introductory Japanese[日本語入門]',
|
28
28
|
code: 'NH1',
|
29
29
|
description: 'Learn basic moonspeak. This course covers introductions, greetings and basic questions and answers for every day life. 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
36
|
description: 'ブルガリアで日常生活が出来る様、挨拶や日常に使う質問と答えの仕方が学べます。ブルガリア語に使われるキリル文字の読み書きも出来る様になります。',
|
37
37
|
credits: 2
|
38
38
|
},
|
39
39
|
|
40
|
-
|
40
|
+
{
|
41
41
|
name: 'メカトロニクス',
|
42
42
|
code: 'MT',
|
43
43
|
description: '電子回路と電気機器とメカニカル機械を効率良く合わせてロボットの基礎や様々のデバイスや機械が作れる様になります。',
|
44
44
|
credits: 8
|
45
45
|
},
|
46
46
|
|
47
|
-
|
47
|
+
{
|
48
48
|
name: 'Атомна физика',
|
49
49
|
code: 'AF1',
|
50
50
|
description: 'Сътворете атомна бомба с лекота',
|
51
51
|
credits: 8
|
52
52
|
},
|
53
53
|
|
54
|
-
|
54
|
+
{
|
55
55
|
name: 'Нинджи наука',
|
56
56
|
code: 'NJ1',
|
57
57
|
description: 'Научете разнообразие от нинджа техники.',
|
58
58
|
credits: 3
|
59
59
|
},
|
60
60
|
|
61
|
-
|
61
|
+
{
|
62
62
|
name: 'Introduction to Ruby',
|
63
63
|
code: 'RB1',
|
64
64
|
description: 'Learn the basics of Ruby programming.',
|
65
65
|
credits: 3
|
66
66
|
},
|
67
67
|
|
68
|
-
|
68
|
+
{
|
69
69
|
name: 'Ruby Programming',
|
70
70
|
code: 'RB2',
|
71
71
|
description: 'Leverage your Ruby skills.',
|
72
72
|
credits: 3
|
73
73
|
},
|
74
74
|
|
75
|
-
|
75
|
+
{
|
76
76
|
name: 'Ruby Guru',
|
77
77
|
code: 'RB3',
|
78
78
|
description: 'Became a ruby guru.',
|
79
79
|
credits: 3
|
80
80
|
},
|
81
81
|
|
82
|
-
|
82
|
+
{
|
83
83
|
name: 'Introduction to node.js',
|
84
84
|
code: 'NJS1',
|
85
85
|
description: 'Learn the basics of node.js programming.',
|
86
86
|
credits: 3
|
87
87
|
},
|
88
88
|
|
89
|
-
|
89
|
+
{
|
90
90
|
name: 'Node.js Programming',
|
91
91
|
code: 'NJS2',
|
92
92
|
description: 'Leverage your node.js skills.',
|
93
93
|
credits: 3
|
94
94
|
},
|
95
95
|
|
96
|
-
|
96
|
+
{
|
97
97
|
name: 'Node.js Guru',
|
98
98
|
code: 'NJS3',
|
99
99
|
description: 'Became a node.js guru.',
|
100
100
|
credits: 3
|
101
101
|
},
|
102
102
|
|
103
|
-
|
103
|
+
{
|
104
104
|
name: 'Introduction to clojure',
|
105
105
|
code: 'CL1',
|
106
106
|
description: 'Learn the basics of clojure programming.',
|
107
107
|
credits: 3
|
108
108
|
},
|
109
109
|
|
110
|
-
|
110
|
+
{
|
111
111
|
name: 'Clojure Programming',
|
112
112
|
code: 'CL2',
|
113
113
|
description: 'Leverage your clojure skills.',
|
114
114
|
credits: 3
|
115
115
|
},
|
116
116
|
|
117
|
-
|
117
|
+
{
|
118
118
|
name: 'Clojure Guru',
|
119
119
|
code: 'CL3',
|
120
120
|
description: 'Became a clojure guru.',
|
@@ -126,5 +126,5 @@ syllabuses = [
|
|
126
126
|
say "Creating #{syllabuses.size} syllabuses ...".yellow
|
127
127
|
|
128
128
|
syllabuses.each do |syllabus|
|
129
|
-
|
129
|
+
Gaku::Syllabus.where(syllabus).first_or_create!
|
130
130
|
end
|
@@ -0,0 +1,13 @@
|
|
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
|
@@ -5,8 +5,8 @@ els = %w(
|
|
5
5
|
JuniorScala SeniorScala ScalaGuru
|
6
6
|
)
|
7
7
|
|
8
|
-
say "Creating #{els.size}
|
8
|
+
say "Creating #{els.size} badges ...".yellow
|
9
9
|
|
10
10
|
els.each do |el|
|
11
|
-
Gaku::
|
11
|
+
Gaku::BadgeType.where(name: el).first_or_create!
|
12
12
|
end
|
@@ -15,8 +15,7 @@ batch_create(@count[:changes]) do
|
|
15
15
|
commute_method_type: @commute_method_type,
|
16
16
|
enrollment_status_code: @enrollment_status,
|
17
17
|
scholarship_status: @scholarship_status,
|
18
|
-
|
19
|
-
student_foreign_id_number: "foreign_number_#{counter}",
|
18
|
+
foreign_id_code: "foreign_id_code_#{counter}"
|
20
19
|
)
|
21
20
|
|
22
21
|
student = Gaku::Student.where(random_student).first_or_create!
|
@@ -26,8 +25,7 @@ batch_create(@count[:changes]) do
|
|
26
25
|
student.enrollment_status_code = enrollment_status.code
|
27
26
|
student.commute_method_type = commute_method_type
|
28
27
|
student.scholarship_status = scholarship_status
|
29
|
-
student.
|
30
|
-
student.student_foreign_id_number = "foreign_number_#{counter+100}"
|
28
|
+
student.foreign_id_code = "foreign_code_#{counter+100}"
|
31
29
|
student.save!
|
32
30
|
|
33
31
|
student.soft_delete
|
@@ -1,5 +1,9 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
|
+
school_year = Gaku::SchoolYear.where(starting: Time.now - 3.months, ending: Time.now + 9.months).first_or_create!
|
4
|
+
active_semester = Gaku::Semester.where(starting: Time.now - 2.months, ending: Time.now + 2.months).first_or_create!
|
5
|
+
not_active_semester = Gaku::Semester.where(starting: Time.now + 3.months, ending: Time.now + 9.months).first_or_create!
|
6
|
+
|
3
7
|
class_groups = [
|
4
8
|
{ name: 'Ms. Moore 3rd Grade', grade: 3 },
|
5
9
|
{ name: 'Advanced', grade: 5 },
|
@@ -20,3 +24,9 @@ say "Creating #{class_groups.size} class groups ...".yellow
|
|
20
24
|
class_groups.each do |class_group|
|
21
25
|
Gaku::ClassGroup.where(class_group).first_or_create!
|
22
26
|
end
|
27
|
+
|
28
|
+
active_class_group = Gaku::ClassGroup.where(name: 'Mr.Kalkov').first
|
29
|
+
not_active_class_group = Gaku::ClassGroup.where(name: 'Mr.Kagetsuki').first
|
30
|
+
|
31
|
+
Gaku::SemesterClassGroup.where(class_group_id: active_class_group.id, semester_id: active_semester.id).first_or_create!
|
32
|
+
Gaku::SemesterClassGroup.where(class_group_id: not_active_class_group.id, semester_id: not_active_semester.id).first_or_create!
|
@@ -1,26 +1,26 @@
|
|
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 with addresses and contacts ...".yellow
|
4
|
+
# say "Creating #{@count[:disposals]} teachers with addresses and contacts ...".yellow
|
5
5
|
|
6
|
-
batch_create(@count[:disposals]) do
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
end
|
6
|
+
# batch_create(@count[:disposals]) do
|
7
|
+
# teacher = Gaku::Teacher.where(random_person).first_or_create!
|
8
|
+
# teacher.addresses.where(random_address.merge(deleted: true)).first_or_create!
|
9
|
+
# teacher.contacts.where(random_home_phone.merge(deleted: true)).first_or_create!
|
10
|
+
# end
|
11
11
|
|
12
|
-
say "Creating #{@count[:disposals]} students with addresses and contacts ...".yellow
|
12
|
+
# say "Creating #{@count[:disposals]} students with addresses and contacts ...".yellow
|
13
13
|
|
14
|
-
batch_create(@count[:disposals]) do
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
end
|
14
|
+
# batch_create(@count[:disposals]) do
|
15
|
+
# student = Gaku::Student.where(random_person).first_or_create!
|
16
|
+
# student.addresses.where(random_address.merge(deleted: true)).first_or_create!
|
17
|
+
# student.contacts.where(random_home_phone.merge(deleted: true)).first_or_create!
|
18
|
+
# end
|
19
19
|
|
20
|
-
say "Creating #{@count[:disposals]} guardians with addresses and contacts ...".yellow
|
20
|
+
# say "Creating #{@count[:disposals]} guardians with addresses and contacts ...".yellow
|
21
21
|
|
22
|
-
batch_create(@count[:disposals]) do
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
end
|
22
|
+
# batch_create(@count[:disposals]) do
|
23
|
+
# guardian = Gaku::Guardian.where(random_person).first_or_create!
|
24
|
+
# guardian.addresses.where(random_address.merge(deleted: true)).first_or_create!
|
25
|
+
# guardian.contacts.where(random_home_phone.merge(deleted: true)).first_or_create!
|
26
|
+
# end
|
data/db/sample/gaku/teachers.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'rake-progressbar'
|
2
|
+
require 'shared_sample_data'
|
2
3
|
|
3
4
|
teachers = [
|
4
5
|
{ name: 'Vassil', surname: 'Kalkov' },
|
@@ -11,21 +12,12 @@ teachers = [
|
|
11
12
|
say 'Creating predefined teachers...'.yellow
|
12
13
|
|
13
14
|
teachers.each do |teacher|
|
14
|
-
|
15
|
+
create_teacher_with_full_info(teacher)
|
15
16
|
end
|
16
17
|
|
17
18
|
|
18
19
|
say "Creating #{@count[:teachers]} teachers...".yellow
|
19
20
|
|
20
21
|
batch_create(@count[:teachers]) do
|
21
|
-
|
22
|
-
|
23
|
-
teacher.addresses.where(random_address).first_or_create!
|
24
|
-
teacher.addresses.where(random_address).first_or_create!
|
25
|
-
|
26
|
-
teacher.contacts.where(random_mobile_phone).first_or_create!
|
27
|
-
teacher.contacts.where(random_home_phone).first_or_create!
|
28
|
-
teacher.contacts.where(random_email).first_or_create!
|
29
|
-
|
30
|
-
teacher.notes.where(random_note).first_or_create!
|
22
|
+
create_teacher_with_full_info
|
31
23
|
end
|
data/lib/shared_sample_data.rb
CHANGED
@@ -5,6 +5,8 @@
|
|
5
5
|
numcode: '392'
|
6
6
|
).first_or_create!
|
7
7
|
|
8
|
+
@state = Gaku::State.where(name: Faker::Address.us_state, country_iso: @country.iso).first_or_create!
|
9
|
+
|
8
10
|
@mobile_phone = Gaku::ContactType.where(name: 'Mobile Phone').first_or_create!
|
9
11
|
@home_phone = Gaku::ContactType.where(name: 'Home Phone').first_or_create!
|
10
12
|
@email = Gaku::ContactType.where(name: 'Email').first_or_create!
|
@@ -21,12 +23,16 @@
|
|
21
23
|
|
22
24
|
def batch_create(count)
|
23
25
|
ActiveRecord::Base.transaction do
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
26
|
+
if Rails.env.development?
|
27
|
+
bar = RakeProgressbar.new(count)
|
28
|
+
count.times do
|
29
|
+
bar.inc
|
30
|
+
yield
|
31
|
+
end
|
32
|
+
bar.finished
|
33
|
+
else
|
34
|
+
count.times { yield }
|
28
35
|
end
|
29
|
-
bar.finished
|
30
36
|
end
|
31
37
|
end
|
32
38
|
|
@@ -76,7 +82,8 @@ def random_address
|
|
76
82
|
title: 'Home address',
|
77
83
|
zipcode: '452-0813',
|
78
84
|
city: 'Nagoya',
|
79
|
-
country: @country
|
85
|
+
country: @country,
|
86
|
+
state: @state
|
80
87
|
}
|
81
88
|
end
|
82
89
|
|
@@ -105,4 +112,20 @@ def create_student_with_full_info(predefined_student=nil)
|
|
105
112
|
#guardian.notes.where(random_note).first_or_create!
|
106
113
|
|
107
114
|
student.guardians << guardian
|
115
|
+
end
|
116
|
+
|
117
|
+
def create_teacher_with_full_info(predefined_teacher=nil)
|
118
|
+
if predefined_teacher
|
119
|
+
teacher = Gaku::Teacher.where(predefined_teacher).first_or_create!
|
120
|
+
else
|
121
|
+
random_teacher = random_person
|
122
|
+
teacher = Gaku::Teacher.where(random_teacher).first_or_create!
|
123
|
+
end
|
124
|
+
|
125
|
+
teacher.addresses.create!(random_address)
|
126
|
+
teacher.contacts.create!(random_email)
|
127
|
+
teacher.contacts.create!(random_home_phone)
|
128
|
+
teacher.contacts.create!(random_mobile_phone)
|
129
|
+
teacher.notes.create!(random_note)
|
130
|
+
teacher.notes.create!(random_note)
|
108
131
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gaku_sample
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rei Kagetsuki
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2014-02-24 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: gaku_core
|
@@ -18,14 +18,14 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - '='
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 0.0
|
21
|
+
version: 0.1.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
25
|
requirements:
|
26
26
|
- - '='
|
27
27
|
- !ruby/object:Gem::Version
|
28
|
-
version: 0.0
|
28
|
+
version: 0.1.0
|
29
29
|
description: Just some sample data
|
30
30
|
email: info@genshin.org
|
31
31
|
executables: []
|
@@ -33,30 +33,30 @@ extensions: []
|
|
33
33
|
extra_rdoc_files: []
|
34
34
|
files:
|
35
35
|
- lib/shared_sample_data.rb
|
36
|
+
- lib/tasks/sample.rake
|
36
37
|
- lib/gaku_sample.rb
|
37
38
|
- lib/sample_counters.rb
|
38
|
-
- lib/tasks/sample.rake
|
39
|
-
- db/sample/gaku/users.rb
|
40
|
-
- db/sample/gaku/students.rb
|
41
39
|
- db/sample/gaku/grading_widget.rb
|
42
|
-
- db/sample/gaku/
|
43
|
-
- db/sample/gaku/course_groups.rb
|
44
|
-
- db/sample/gaku/teachers.rb
|
45
|
-
- db/sample/gaku/changes/student_changes.rb
|
46
|
-
- db/sample/gaku/disposals/exam_disposals.rb
|
47
|
-
- db/sample/gaku/disposals/student_disposals.rb
|
48
|
-
- db/sample/gaku/disposals/course_group_disposals.rb
|
40
|
+
- db/sample/gaku/users.rb
|
49
41
|
- db/sample/gaku/disposals/teacher_disposals.rb
|
42
|
+
- db/sample/gaku/disposals/student_disposals.rb
|
43
|
+
- db/sample/gaku/disposals/exam_disposals.rb
|
50
44
|
- db/sample/gaku/disposals/attachment_disposals.rb
|
51
45
|
- db/sample/gaku/disposals/address_and_contact_disposals.rb
|
52
|
-
- db/sample/gaku/
|
53
|
-
- db/sample/gaku/
|
54
|
-
- db/sample/gaku/
|
55
|
-
- db/sample/gaku/courses.rb
|
56
|
-
- db/sample/gaku/achievements.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
|
57
49
|
- db/sample/gaku/specialties.rb
|
50
|
+
- db/sample/gaku/badge_types.rb
|
51
|
+
- db/sample/gaku/class_groups.rb
|
52
|
+
- db/sample/gaku/images/120x120.jpg
|
53
|
+
- db/sample/gaku/teachers.rb
|
54
|
+
- db/sample/gaku/students.rb
|
58
55
|
- db/sample/gaku/extracurricular_activities.rb
|
59
|
-
- db/sample/gaku/
|
56
|
+
- db/sample/gaku/exams.rb
|
57
|
+
- db/sample/gaku/01-syllabuses.rb
|
58
|
+
- db/sample/gaku/roles.rb
|
59
|
+
- db/sample/gaku/02-courses.rb
|
60
60
|
homepage: http://github.com/Genshin/gaku
|
61
61
|
licenses: []
|
62
62
|
metadata: {}
|
@@ -75,10 +75,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
75
75
|
- !ruby/object:Gem::Version
|
76
76
|
version: '0'
|
77
77
|
requirements:
|
78
|
-
-
|
79
|
-
-
|
78
|
+
- postgresql
|
79
|
+
- postgresql-contrib
|
80
80
|
rubyforge_project:
|
81
|
-
rubygems_version: 2.
|
81
|
+
rubygems_version: 2.1.11
|
82
82
|
signing_key:
|
83
83
|
specification_version: 4
|
84
84
|
summary: Sample data for use with GAKU Engine
|