meibo 0.13.0 → 0.14.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 +5 -1
- data/lib/meibo/classroom.rb +4 -0
- data/lib/meibo/course.rb +4 -0
- data/lib/meibo/data_set.rb +7 -15
- data/lib/meibo/organization.rb +16 -0
- data/lib/meibo/user.rb +4 -4
- data/lib/meibo/user_profile.rb +4 -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: 5ad0dc346f3bc9d8166c4ddc9a55ddfedc79bcf78aea61f83289e339a40dfea4
|
4
|
+
data.tar.gz: d2bf911450a3c05d334e3b6c5ea7ea9a2dd8e9cb141ce125f0d6a95a99e4daca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fb78b3143e372d6629f174fe3e0d34eea05ecbaf11bb1b8c0478c09a6a78c9792349f850da3f7530f5e20e5503b5151907dd6e7ee85a46dc286f5bc1f24cbc71
|
7
|
+
data.tar.gz: d28830dba3e605a95bca895ddc2655d6921707884c0fefa5257e79766e400f13bcc7e9c47a940c8687f4a874a2e8d4178ef61aef721cd7bcd16e784d4aeac2ab
|
data/Gemfile.lock
CHANGED
@@ -62,7 +62,11 @@ module Meibo
|
|
62
62
|
end
|
63
63
|
|
64
64
|
def parent
|
65
|
-
Meibo.current_roster.academic_sessions.find(parent_sourced_id)
|
65
|
+
parent_sourced_id && Meibo.current_roster.academic_sessions.find(parent_sourced_id)
|
66
|
+
end
|
67
|
+
|
68
|
+
def children
|
69
|
+
Meibo.current_roster.academic_sessions.where(parent_sourced_id: sourced_id)
|
66
70
|
end
|
67
71
|
end
|
68
72
|
end
|
data/lib/meibo/classroom.rb
CHANGED
data/lib/meibo/course.rb
CHANGED
data/lib/meibo/data_set.rb
CHANGED
@@ -42,19 +42,17 @@ module Meibo
|
|
42
42
|
raise DataNotFoundError, "sourcedId: #{sourced_id} が見つかりません"
|
43
43
|
end
|
44
44
|
|
45
|
-
def
|
46
|
-
|
47
|
-
end
|
48
|
-
|
49
|
-
def by_user(user_sourced_id)
|
50
|
-
data_by_user_sourced_id[user_sourced_id]
|
45
|
+
def where(**conditions)
|
46
|
+
group_cache[conditions.keys.sort][conditions.values]
|
51
47
|
end
|
52
48
|
|
53
49
|
private
|
54
50
|
|
55
|
-
def
|
56
|
-
@cache[:
|
57
|
-
[
|
51
|
+
def group_cache
|
52
|
+
@cache[:group_cache] ||= Hash.new do |hash, keys|
|
53
|
+
hash[keys] = @data.group_by {|datum| keys.map {|attribute| datum.public_send(attribute) } }.to_h do |values, data|
|
54
|
+
[values, new(data)]
|
55
|
+
end
|
58
56
|
end
|
59
57
|
end
|
60
58
|
|
@@ -62,12 +60,6 @@ module Meibo
|
|
62
60
|
@cache[:data_by_sourced_id] ||= @data.to_h {|datum| [datum.sourced_id, datum] }
|
63
61
|
end
|
64
62
|
|
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
63
|
def new(data)
|
72
64
|
self.class.new(data, roster: roster)
|
73
65
|
end
|
data/lib/meibo/organization.rb
CHANGED
@@ -68,5 +68,21 @@ module Meibo
|
|
68
68
|
def parent
|
69
69
|
parent_sourced_id && Meibo.current_roster.organizations.find(parent_sourced_id)
|
70
70
|
end
|
71
|
+
|
72
|
+
def enrollments
|
73
|
+
Meibo.current_roster.enrollments.where(school_sourced_id: sourced_id)
|
74
|
+
end
|
75
|
+
|
76
|
+
def classes
|
77
|
+
Meibo.current_roster.classes.where(school_sourced_id: sourced_id)
|
78
|
+
end
|
79
|
+
|
80
|
+
def courses
|
81
|
+
Meibo.current_roster.courses.where(org_sourced_id: sourced_id)
|
82
|
+
end
|
83
|
+
|
84
|
+
def roles
|
85
|
+
Meibo.current_roster.roles.where(org_sourced_id: sourced_id)
|
86
|
+
end
|
71
87
|
end
|
72
88
|
end
|
data/lib/meibo/user.rb
CHANGED
@@ -79,7 +79,7 @@ module Meibo
|
|
79
79
|
end
|
80
80
|
|
81
81
|
def enrollments
|
82
|
-
Meibo.current_roster.enrollments.
|
82
|
+
Meibo.current_roster.enrollments.where(user_sourced_id: sourced_id)
|
83
83
|
end
|
84
84
|
|
85
85
|
def primary_organization
|
@@ -87,17 +87,17 @@ module Meibo
|
|
87
87
|
end
|
88
88
|
|
89
89
|
def primary_role_in(org)
|
90
|
-
Meibo.current_roster.roles.
|
90
|
+
Meibo.current_roster.roles.where(user_sourced_id: sourced_id).detect do |role|
|
91
91
|
role.primary? && role.org_sourced_id == org.sourced_id
|
92
92
|
end
|
93
93
|
end
|
94
94
|
|
95
95
|
def roles
|
96
|
-
Meibo.current_roster.roles.
|
96
|
+
Meibo.current_roster.roles.where(user_sourced_id: sourced_id)
|
97
97
|
end
|
98
98
|
|
99
99
|
def user_profiles
|
100
|
-
Meibo.current_roster.user_profiles.
|
100
|
+
Meibo.current_roster.user_profiles.where(user_sourced_id: sourced_id)
|
101
101
|
end
|
102
102
|
end
|
103
103
|
end
|
data/lib/meibo/user_profile.rb
CHANGED
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.14.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-16 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.14.0/CHANGELOG.md
|
129
129
|
post_install_message:
|
130
130
|
rdoc_options: []
|
131
131
|
require_paths:
|