Package not found. Please check the package name and try again.
mumuki-domain 8.0.0 → 8.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/models/assignment.rb +4 -4
- data/app/models/concerns/container.rb +8 -0
- data/app/models/concerns/with_usages.rb +12 -0
- data/app/models/discussion.rb +4 -0
- data/app/models/exercise.rb +12 -0
- data/app/models/user.rb +9 -3
- data/lib/mumuki/domain/extensions/array.rb +4 -0
- data/lib/mumuki/domain/helpers/organization.rb +1 -1
- data/lib/mumuki/domain/helpers/user.rb +22 -5
- data/lib/mumuki/domain/incognito.rb +9 -1
- data/lib/mumuki/domain/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9075756cb0cd46b955959afe62c837fb11a293cf520f7e7a3e0666c88e9bc014
|
|
4
|
+
data.tar.gz: a775162a5319a08a2a2953586bd59efd3cca7ebffddb9c72b236175c5dcbb1a8
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: '08190f559ca10836c7d2cfd9c98a864ea18d31fb1f13115727ffc9738a7913fe4af136571b0036c1701b166162e61d2d726653a0cb8f3f1711f9677bde815e03'
|
|
7
|
+
data.tar.gz: ed6f365ac0c552ccd2f5136fd825052b51da29846a6ea042d27a57e991008d5cfe02265a5450eb2a9b62756ddfb96300c5be1f47dd699b26a8d47b57883c3758
|
data/app/models/assignment.rb
CHANGED
|
@@ -52,10 +52,10 @@ class Assignment < Progress
|
|
|
52
52
|
self.organization = Organization.current
|
|
53
53
|
end
|
|
54
54
|
|
|
55
|
-
def recontextualize!
|
|
56
|
-
if organization !=
|
|
55
|
+
def recontextualize!(new_organization = Organization.current)
|
|
56
|
+
if organization != new_organization
|
|
57
57
|
dirty_parent_by_submission! if organization.present? && exercise.used_in?(organization)
|
|
58
|
-
self.organization =
|
|
58
|
+
self.organization = new_organization
|
|
59
59
|
self.parent_id = nil
|
|
60
60
|
end
|
|
61
61
|
end
|
|
@@ -126,7 +126,7 @@ class Assignment < Progress
|
|
|
126
126
|
end
|
|
127
127
|
|
|
128
128
|
def content=(content)
|
|
129
|
-
|
|
129
|
+
unless exercise.reading?
|
|
130
130
|
self.solution = exercise.single_choice? ? exercise.choice_index_for(content) : content
|
|
131
131
|
end
|
|
132
132
|
end
|
|
@@ -20,6 +20,14 @@ module Container
|
|
|
20
20
|
content.progress_for(user, organization)
|
|
21
21
|
end
|
|
22
22
|
|
|
23
|
+
def navigable_content_in(organization = Organization.current)
|
|
24
|
+
content.usage_in_organization(organization)
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def content_used_in?(organization)
|
|
28
|
+
navigable_content_in(organization).present?
|
|
29
|
+
end
|
|
30
|
+
|
|
23
31
|
private
|
|
24
32
|
|
|
25
33
|
# Generally we are calling progress_for for each sibling. That method needs the
|
|
@@ -16,6 +16,18 @@ module WithUsages
|
|
|
16
16
|
item.is_a?(type) ? item : nil
|
|
17
17
|
end
|
|
18
18
|
|
|
19
|
+
def navigable_content_in(organization = Organization.current)
|
|
20
|
+
self if used_in?(organization)
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def content_used_in?(organization)
|
|
24
|
+
navigable_content_in(organization).present?
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def used_in?(organization)
|
|
28
|
+
usage_in_organization(organization).present?
|
|
29
|
+
end
|
|
30
|
+
|
|
19
31
|
class_methods do
|
|
20
32
|
def aggregate_of(association)
|
|
21
33
|
super
|
data/app/models/discussion.rb
CHANGED
data/app/models/exercise.rb
CHANGED
|
@@ -47,6 +47,14 @@ class Exercise < ApplicationRecord
|
|
|
47
47
|
guide.usage_in_organization(organization).present?
|
|
48
48
|
end
|
|
49
49
|
|
|
50
|
+
def navigable_content_in(organization = Organization.current)
|
|
51
|
+
self if used_in?(organization)
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def content_used_in?(organization)
|
|
55
|
+
navigable_content_in(organization).present?
|
|
56
|
+
end
|
|
57
|
+
|
|
50
58
|
def structural_parent
|
|
51
59
|
guide
|
|
52
60
|
end
|
|
@@ -231,6 +239,10 @@ class Exercise < ApplicationRecord
|
|
|
231
239
|
guide.pending_exercises(user)
|
|
232
240
|
end
|
|
233
241
|
|
|
242
|
+
def reading?
|
|
243
|
+
is_a? Reading
|
|
244
|
+
end
|
|
245
|
+
|
|
234
246
|
private
|
|
235
247
|
|
|
236
248
|
def evaluation_class
|
data/app/models/user.rb
CHANGED
|
@@ -243,9 +243,9 @@ class User < ApplicationRecord
|
|
|
243
243
|
Organization.current? ? Organization.current : main_organization
|
|
244
244
|
end
|
|
245
245
|
|
|
246
|
-
def current_immersive_context_at(
|
|
246
|
+
def current_immersive_context_at(path_item)
|
|
247
247
|
if Organization.current?
|
|
248
|
-
immersive_organization_at(
|
|
248
|
+
immersive_organization_at(path_item) || Organization.current
|
|
249
249
|
else
|
|
250
250
|
main_organization
|
|
251
251
|
end
|
|
@@ -259,13 +259,19 @@ class User < ApplicationRecord
|
|
|
259
259
|
new_permissions: permissions.as_json
|
|
260
260
|
}
|
|
261
261
|
end
|
|
262
|
-
|
|
262
|
+
|
|
263
263
|
def save_and_notify!
|
|
264
264
|
save!
|
|
265
265
|
notify_permissions_changed!
|
|
266
266
|
self
|
|
267
267
|
end
|
|
268
268
|
|
|
269
|
+
def current_immersive_context_and_content_at(path_item)
|
|
270
|
+
immersive_organization_with_content_at(path_item).tap do |orga, _|
|
|
271
|
+
return [Organization.current, path_item] unless orga.present?
|
|
272
|
+
end
|
|
273
|
+
end
|
|
274
|
+
|
|
269
275
|
private
|
|
270
276
|
|
|
271
277
|
def welcome_to_new_organizations!
|
|
@@ -29,7 +29,7 @@ module Mumuki::Domain::Helpers::Organization
|
|
|
29
29
|
end
|
|
30
30
|
|
|
31
31
|
def immersed_in?(other)
|
|
32
|
-
immersible? && other.immersive? && target_audience == other.target_audience
|
|
32
|
+
immersible? && other.immersive? && !other.disabled? && target_audience == other.target_audience
|
|
33
33
|
end
|
|
34
34
|
|
|
35
35
|
def switch!
|
|
@@ -101,12 +101,21 @@ module Mumuki::Domain::Helpers::User
|
|
|
101
101
|
end
|
|
102
102
|
|
|
103
103
|
def immersive_organizations_at(path_item, current = Organization.current)
|
|
104
|
-
return [] unless current.immersible?
|
|
105
|
-
|
|
106
104
|
usage_filter = path_item ? lambda { |it| path_item.used_in?(it) } : lambda { |_| true }
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
105
|
+
immersive_organizations_for(current).select(&usage_filter)
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
def immersive_organization_with_content_at(path_item, current = Organization.current)
|
|
109
|
+
orga = immersive_organizations_with_content_at(path_item, current).single
|
|
110
|
+
[orga, path_item&.navigable_content_in(orga)]
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
def immersive_organizations_with_content_at(path_item, current = Organization.current)
|
|
114
|
+
immersive_without_usage = immersive_organizations_for(current)
|
|
115
|
+
return immersive_without_usage unless path_item.present?
|
|
116
|
+
|
|
117
|
+
immersive_with_usage = immersive_without_usage.select { |it| path_item.content_used_in? it }
|
|
118
|
+
immersive_with_usage.empty? ? immersive_without_usage : immersive_with_usage
|
|
110
119
|
end
|
|
111
120
|
|
|
112
121
|
## API Exposure
|
|
@@ -120,4 +129,12 @@ module Mumuki::Domain::Helpers::User
|
|
|
120
129
|
[:first_name, :last_name, :gender, :birthdate]
|
|
121
130
|
end
|
|
122
131
|
end
|
|
132
|
+
|
|
133
|
+
private
|
|
134
|
+
|
|
135
|
+
def immersive_organizations_for(organization)
|
|
136
|
+
return [] unless organization.immersible?
|
|
137
|
+
|
|
138
|
+
student_granted_organizations.select { |it| organization.immersed_in?(it) }
|
|
139
|
+
end
|
|
123
140
|
end
|
|
@@ -52,7 +52,15 @@ module Mumuki::Domain
|
|
|
52
52
|
nil
|
|
53
53
|
end
|
|
54
54
|
|
|
55
|
-
def
|
|
55
|
+
def current_immersive_context_and_content_at(_)
|
|
56
|
+
[nil, nil]
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
def immersive_organizations_with_content_at(_, _ = nil)
|
|
60
|
+
[]
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
def immersive_organizations_at(_, _ = nil)
|
|
56
64
|
[]
|
|
57
65
|
end
|
|
58
66
|
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: mumuki-domain
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 8.
|
|
4
|
+
version: 8.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Franco Leonardo Bulgarelli
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2020-11-
|
|
11
|
+
date: 2020-11-26 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rails
|
|
@@ -128,14 +128,14 @@ dependencies:
|
|
|
128
128
|
requirements:
|
|
129
129
|
- - "~>"
|
|
130
130
|
- !ruby/object:Gem::Version
|
|
131
|
-
version: '6.
|
|
131
|
+
version: '6.1'
|
|
132
132
|
type: :runtime
|
|
133
133
|
prerelease: false
|
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
|
135
135
|
requirements:
|
|
136
136
|
- - "~>"
|
|
137
137
|
- !ruby/object:Gem::Version
|
|
138
|
-
version: '6.
|
|
138
|
+
version: '6.1'
|
|
139
139
|
- !ruby/object:Gem::Dependency
|
|
140
140
|
name: mumukit-sync
|
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|