meibo 0.14.0 → 0.16.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5ad0dc346f3bc9d8166c4ddc9a55ddfedc79bcf78aea61f83289e339a40dfea4
4
- data.tar.gz: d2bf911450a3c05d334e3b6c5ea7ea9a2dd8e9cb141ce125f0d6a95a99e4daca
3
+ metadata.gz: e25f22026f4551e67b4016aad6a5e526e8ccfefe07e860b0f1ec092b6e21dd37
4
+ data.tar.gz: 608bd3b794791f86d01a3931ddb17433d26ce7631ac125881b3bb01f14e7958d
5
5
  SHA512:
6
- metadata.gz: fb78b3143e372d6629f174fe3e0d34eea05ecbaf11bb1b8c0478c09a6a78c9792349f850da3f7530f5e20e5503b5151907dd6e7ee85a46dc286f5bc1f24cbc71
7
- data.tar.gz: d28830dba3e605a95bca895ddc2655d6921707884c0fefa5257e79766e400f13bcc7e9c47a940c8687f4a874a2e8d4178ef61aef721cd7bcd16e784d4aeac2ab
6
+ metadata.gz: 0cc22ea80b35a152b99de89bd6452cad6699d950653a8461976f73e0d93f64e4a3974641cf1f12802372e0a8d9f8f31e2b7c7d1c49deddbd03d66eb2006970f4
7
+ data.tar.gz: 3f60761df5b94e9dd8f60661b730598b34788c6ff980eb83924bc8c472a9facf890e12d0b08a6d777fdd4184954d023f37fb613b494eee889544664807ada22d
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- meibo (0.14.0)
4
+ meibo (0.16.0)
5
5
  rubyzip
6
6
  zeitwerk
7
7
 
@@ -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,11 +66,11 @@ module Meibo
62
66
  end
63
67
 
64
68
  def parent
65
- parent_sourced_id && Meibo.current_roster.academic_sessions.find(parent_sourced_id)
69
+ parent_sourced_id && collection.find(parent_sourced_id)
66
70
  end
67
71
 
68
72
  def children
69
- Meibo.current_roster.academic_sessions.where(parent_sourced_id: sourced_id)
73
+ collection.where(parent_sourced_id: sourced_id)
70
74
  end
71
75
  end
72
76
  end
@@ -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
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
@@ -61,6 +61,10 @@ module Meibo
61
61
  klass.define_singleton_method(:write_converters) { write_converter }
62
62
  end
63
63
 
64
+ def lineno
65
+ collection.lineno(self)
66
+ end
67
+
64
68
  def to_csv(...)
65
69
  to_a.to_csv(...)
66
70
  end
@@ -42,6 +42,11 @@ module Meibo
42
42
  raise DataNotFoundError, "sourcedId: #{sourced_id} が見つかりません"
43
43
  end
44
44
 
45
+ def lineno(datum)
46
+ # NOTE: add one for one-based, and add one for header line
47
+ find_index(datum)&.+(2)
48
+ end
49
+
45
50
  def where(**conditions)
46
51
  group_cache[conditions.keys.sort][conditions.values]
47
52
  end
@@ -67,6 +67,10 @@ module Meibo
67
67
  @extension_fields = extension_fields
68
68
  end
69
69
 
70
+ def collection
71
+ Meibo.current_roster.demographics
72
+ end
73
+
70
74
  def male?
71
75
  sex == SEX[:male]
72
76
  end
@@ -46,6 +46,10 @@ module Meibo
46
46
  @extension_fields = extension_fields
47
47
  end
48
48
 
49
+ def collection
50
+ Meibo.current_roster.enrollments
51
+ end
52
+
49
53
  def administrator?
50
54
  role == ROLES[:administrator]
51
55
  end
@@ -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,11 @@ module Meibo
66
70
  end
67
71
 
68
72
  def parent
69
- parent_sourced_id && Meibo.current_roster.organizations.find(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)
70
78
  end
71
79
 
72
80
  def enrollments
data/lib/meibo/role.rb CHANGED
@@ -62,6 +62,10 @@ module Meibo
62
62
  @extension_fields = extension_fields
63
63
  end
64
64
 
65
+ def collection
66
+ Meibo.current_roster.roles
67
+ end
68
+
65
69
  def primary?
66
70
  @role_type == TYPES[:primary]
67
71
  end
data/lib/meibo/roster.rb CHANGED
@@ -69,15 +69,15 @@ module Meibo
69
69
  def initialize(profile: Meibo.default_profile, manifest_properties: {}, academic_sessions: [], classes: [], courses: [], demographics: [], enrollments: [], organizations: [], roles: [], user_profiles: [], users: [])
70
70
  @profile = profile
71
71
  @manifest_properties = manifest_properties
72
- @academic_sessions = AcademicSessionSet.new(academic_sessions, roster: self)
73
- @organizations = OrganizationSet.new(organizations, roster: self)
74
- @courses = CourseSet.new(courses, roster: self)
75
- @classes = ClassroomSet.new(classes, roster: self)
76
- @users = UserSet.new(users, roster: self)
77
- @demographics = DemographicSet.new(demographics, roster: self)
78
- @user_profiles = UserProfileSet.new(user_profiles, roster: self)
79
- @roles = RoleSet.new(roles, roster: self)
80
- @enrollments = EnrollmentSet.new(enrollments, roster: self)
72
+ @academic_sessions = profile.data_set_for(:academic_sessions).new(academic_sessions, roster: self)
73
+ @classes = profile.data_set_for(:classes).new(classes, roster: self)
74
+ @courses = profile.data_set_for(:courses).new(courses, roster: self)
75
+ @demographics = profile.data_set_for(:demographics).new(demographics, roster: self)
76
+ @enrollments = profile.data_set_for(:enrollments).new(enrollments, roster: self)
77
+ @organizations = profile.data_set_for(:orgs).new(organizations, roster: self)
78
+ @roles = profile.data_set_for(:roles).new(roles, roster: self)
79
+ @user_profiles = profile.data_set_for(:user_profiles).new(user_profiles, roster: self)
80
+ @users = profile.data_set_for(:users).new(users, roster: self)
81
81
  end
82
82
 
83
83
  def builder
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
@@ -39,6 +39,10 @@ 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
data/lib/meibo/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Meibo
4
- VERSION = "0.14.0"
4
+ VERSION = "0.16.0"
5
5
  end
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.14.0
4
+ version: 0.16.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-16 00:00:00.000000000 Z
11
+ date: 2022-11-24 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.14.0/CHANGELOG.md
128
+ changelog_uri: https://github.com/hanachin/meibo/blob/meibo/v0.16.0/CHANGELOG.md
129
129
  post_install_message:
130
130
  rdoc_options: []
131
131
  require_paths: