meibo 0.13.0 → 0.15.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/meibo/academic_session.rb +9 -1
- data/lib/meibo/classroom.rb +8 -0
- data/lib/meibo/course.rb +8 -0
- data/lib/meibo/data_model.rb +4 -0
- data/lib/meibo/data_set.rb +10 -13
- data/lib/meibo/demographic.rb +4 -0
- data/lib/meibo/enrollment.rb +4 -0
- data/lib/meibo/organization.rb +25 -1
- data/lib/meibo/role.rb +4 -0
- data/lib/meibo/user.rb +8 -4
- data/lib/meibo/user_profile.rb +8 -0
- data/lib/meibo/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0f093d7946a8add1449f8ae9c89c94a47431f36386c598dfeb21ca225ca9c167
|
4
|
+
data.tar.gz: facfe3ab95a9e3c4f61885afedea7df1c8f657725f4e61b6918da4e58f0375ec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c472f7f3874f886ae4c27b9fb93b8a8024f820b1a6172b04b54efcfcaca5672faca6d1235845d9bad8daf63fa9a277714140ee9114ca537ced93e584a6c45d55
|
7
|
+
data.tar.gz: 0220f2730b1ee389f13e7c114a87964a82a7777e3c1662963c04977f74a9bfa85b0c5afbacd2701a483aef3c9ba6f30c1f4be8d6722081334288b4d5bb590864
|
data/Gemfile.lock
CHANGED
@@ -45,6 +45,10 @@ module Meibo
|
|
45
45
|
@extension_fields = extension_fields
|
46
46
|
end
|
47
47
|
|
48
|
+
def collection
|
49
|
+
Meibo.current_roster.academic_sessions
|
50
|
+
end
|
51
|
+
|
48
52
|
def grading_period?
|
49
53
|
type == TYPES[:grading_period]
|
50
54
|
end
|
@@ -62,7 +66,11 @@ module Meibo
|
|
62
66
|
end
|
63
67
|
|
64
68
|
def parent
|
65
|
-
|
69
|
+
parent_sourced_id && collection.find(parent_sourced_id)
|
70
|
+
end
|
71
|
+
|
72
|
+
def children
|
73
|
+
collection.where(parent_sourced_id: sourced_id)
|
66
74
|
end
|
67
75
|
end
|
68
76
|
end
|
data/lib/meibo/classroom.rb
CHANGED
@@ -64,6 +64,10 @@ module Meibo
|
|
64
64
|
@extension_fields = extension_fields
|
65
65
|
end
|
66
66
|
|
67
|
+
def collection
|
68
|
+
Meibo.current_roster.classes
|
69
|
+
end
|
70
|
+
|
67
71
|
def homeroom?
|
68
72
|
class_type == TYPES[:homeroom]
|
69
73
|
end
|
@@ -83,5 +87,9 @@ module Meibo
|
|
83
87
|
def terms
|
84
88
|
term_sourced_ids.map {|term_sourced_id| Meibo.current_roster.academic_sessions.find(term_sourced_id) }
|
85
89
|
end
|
90
|
+
|
91
|
+
def enrollments
|
92
|
+
Meibo.current_roster.enrollments.where(class_sourced_id: sourced_id)
|
93
|
+
end
|
86
94
|
end
|
87
95
|
end
|
data/lib/meibo/course.rb
CHANGED
@@ -42,6 +42,10 @@ module Meibo
|
|
42
42
|
@extension_fields = extension_fields
|
43
43
|
end
|
44
44
|
|
45
|
+
def collection
|
46
|
+
Meibo.current_roster.courses
|
47
|
+
end
|
48
|
+
|
45
49
|
def organization
|
46
50
|
Meibo.current_roster.organizations.find(org_sourced_id)
|
47
51
|
end
|
@@ -49,5 +53,9 @@ module Meibo
|
|
49
53
|
def school_year
|
50
54
|
Meibo.current_roster.academic_sessions.find(school_year_sourced_id)
|
51
55
|
end
|
56
|
+
|
57
|
+
def classes
|
58
|
+
Meibo.current_roster.classes.where(course_sourced_id: sourced_id)
|
59
|
+
end
|
52
60
|
end
|
53
61
|
end
|
data/lib/meibo/data_model.rb
CHANGED
data/lib/meibo/data_set.rb
CHANGED
@@ -42,19 +42,22 @@ module Meibo
|
|
42
42
|
raise DataNotFoundError, "sourcedId: #{sourced_id} が見つかりません"
|
43
43
|
end
|
44
44
|
|
45
|
-
def
|
46
|
-
|
45
|
+
def lineno(datum)
|
46
|
+
# NOTE: add one for one-based, and add one for header line
|
47
|
+
find_index(datum)&.+(2)
|
47
48
|
end
|
48
49
|
|
49
|
-
def
|
50
|
-
|
50
|
+
def where(**conditions)
|
51
|
+
group_cache[conditions.keys.sort][conditions.values]
|
51
52
|
end
|
52
53
|
|
53
54
|
private
|
54
55
|
|
55
|
-
def
|
56
|
-
@cache[:
|
57
|
-
[
|
56
|
+
def group_cache
|
57
|
+
@cache[:group_cache] ||= Hash.new do |hash, keys|
|
58
|
+
hash[keys] = @data.group_by {|datum| keys.map {|attribute| datum.public_send(attribute) } }.to_h do |values, data|
|
59
|
+
[values, new(data)]
|
60
|
+
end
|
58
61
|
end
|
59
62
|
end
|
60
63
|
|
@@ -62,12 +65,6 @@ module Meibo
|
|
62
65
|
@cache[:data_by_sourced_id] ||= @data.to_h {|datum| [datum.sourced_id, datum] }
|
63
66
|
end
|
64
67
|
|
65
|
-
def data_by_user_sourced_id
|
66
|
-
@cache[:data_by_user_sourced_id] ||= @data.group_by(&:user_sourced_id).to_h do |user_sourced_id, data|
|
67
|
-
[user_sourced_id, new(data)]
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
71
68
|
def new(data)
|
72
69
|
self.class.new(data, roster: roster)
|
73
70
|
end
|
data/lib/meibo/demographic.rb
CHANGED
data/lib/meibo/enrollment.rb
CHANGED
data/lib/meibo/organization.rb
CHANGED
@@ -41,6 +41,10 @@ module Meibo
|
|
41
41
|
@extension_fields = extension_fields
|
42
42
|
end
|
43
43
|
|
44
|
+
def collection
|
45
|
+
Meibo.current_roster.organizations
|
46
|
+
end
|
47
|
+
|
44
48
|
def department?
|
45
49
|
type == TYPES[:department]
|
46
50
|
end
|
@@ -66,7 +70,27 @@ module Meibo
|
|
66
70
|
end
|
67
71
|
|
68
72
|
def parent
|
69
|
-
parent_sourced_id &&
|
73
|
+
parent_sourced_id && collection.find(parent_sourced_id)
|
74
|
+
end
|
75
|
+
|
76
|
+
def children
|
77
|
+
collection.where(parent_sourced_id: sourced_id)
|
78
|
+
end
|
79
|
+
|
80
|
+
def enrollments
|
81
|
+
Meibo.current_roster.enrollments.where(school_sourced_id: sourced_id)
|
82
|
+
end
|
83
|
+
|
84
|
+
def classes
|
85
|
+
Meibo.current_roster.classes.where(school_sourced_id: sourced_id)
|
86
|
+
end
|
87
|
+
|
88
|
+
def courses
|
89
|
+
Meibo.current_roster.courses.where(org_sourced_id: sourced_id)
|
90
|
+
end
|
91
|
+
|
92
|
+
def roles
|
93
|
+
Meibo.current_roster.roles.where(org_sourced_id: sourced_id)
|
70
94
|
end
|
71
95
|
end
|
72
96
|
end
|
data/lib/meibo/role.rb
CHANGED
data/lib/meibo/user.rb
CHANGED
@@ -68,6 +68,10 @@ module Meibo
|
|
68
68
|
@extension_fields = extension_fields
|
69
69
|
end
|
70
70
|
|
71
|
+
def collection
|
72
|
+
Meibo.current_roster.users
|
73
|
+
end
|
74
|
+
|
71
75
|
def agents
|
72
76
|
agent_sourced_ids.map {|agent_sourced_id| Meibo.current_roster.users.find(agent_sourced_id) }
|
73
77
|
end
|
@@ -79,7 +83,7 @@ module Meibo
|
|
79
83
|
end
|
80
84
|
|
81
85
|
def enrollments
|
82
|
-
Meibo.current_roster.enrollments.
|
86
|
+
Meibo.current_roster.enrollments.where(user_sourced_id: sourced_id)
|
83
87
|
end
|
84
88
|
|
85
89
|
def primary_organization
|
@@ -87,17 +91,17 @@ module Meibo
|
|
87
91
|
end
|
88
92
|
|
89
93
|
def primary_role_in(org)
|
90
|
-
Meibo.current_roster.roles.
|
94
|
+
Meibo.current_roster.roles.where(user_sourced_id: sourced_id).detect do |role|
|
91
95
|
role.primary? && role.org_sourced_id == org.sourced_id
|
92
96
|
end
|
93
97
|
end
|
94
98
|
|
95
99
|
def roles
|
96
|
-
Meibo.current_roster.roles.
|
100
|
+
Meibo.current_roster.roles.where(user_sourced_id: sourced_id)
|
97
101
|
end
|
98
102
|
|
99
103
|
def user_profiles
|
100
|
-
Meibo.current_roster.user_profiles.
|
104
|
+
Meibo.current_roster.user_profiles.where(user_sourced_id: sourced_id)
|
101
105
|
end
|
102
106
|
end
|
103
107
|
end
|
data/lib/meibo/user_profile.rb
CHANGED
@@ -39,8 +39,16 @@ module Meibo
|
|
39
39
|
@extension_fields = extension_fields
|
40
40
|
end
|
41
41
|
|
42
|
+
def collection
|
43
|
+
Meibo.current_roster.user_profiles
|
44
|
+
end
|
45
|
+
|
42
46
|
def user
|
43
47
|
Meibo.current_roster.users.find(user_sourced_id)
|
44
48
|
end
|
49
|
+
|
50
|
+
def role
|
51
|
+
Meibo.current_roster.roles.where(user_profile_sourced_id: sourced_id).first
|
52
|
+
end
|
45
53
|
end
|
46
54
|
end
|
data/lib/meibo/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: meibo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.15.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Seiei Miyagi
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-11-
|
11
|
+
date: 2022-11-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubyzip
|
@@ -125,7 +125,7 @@ metadata:
|
|
125
125
|
allowed_push_host: https://rubygems.org/
|
126
126
|
homepage_uri: https://github.com/hanachin/meibo
|
127
127
|
source_code_uri: https://github.com/hanachin/meibo
|
128
|
-
changelog_uri: https://github.com/hanachin/meibo/blob/meibo/v0.
|
128
|
+
changelog_uri: https://github.com/hanachin/meibo/blob/meibo/v0.15.0/CHANGELOG.md
|
129
129
|
post_install_message:
|
130
130
|
rdoc_options: []
|
131
131
|
require_paths:
|