mumuki-domain 8.1.2 → 8.1.3
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 +1 -1
- data/app/models/concerns/with_expectations.rb +3 -7
- data/app/models/concerns/with_randomizations.rb +1 -2
- data/app/models/exercise.rb +3 -5
- data/app/models/exercise/challenge.rb +4 -2
- data/app/models/exercise/problem.rb +5 -10
- data/lib/mumuki/domain/extensions.rb +2 -0
- data/lib/mumuki/domain/extensions/array.rb +2 -4
- data/lib/mumuki/domain/extensions/hash.rb +4 -0
- data/lib/mumuki/domain/extensions/nil.rb +17 -0
- data/lib/mumuki/domain/extensions/string.rb +2 -9
- data/lib/mumuki/domain/extensions/symbol.rb +5 -0
- data/lib/mumuki/domain/locales/activerecord/en.yml +1 -1
- data/lib/mumuki/domain/locales/activerecord/es-CL.yml +1 -1
- data/lib/mumuki/domain/locales/activerecord/es.yml +1 -1
- data/lib/mumuki/domain/locales/activerecord/pt.yml +1 -1
- data/lib/mumuki/domain/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9495d00fe4f85bdc27f5cf67b94e5f09de465a31a795e9e3d56b3f4cd91433e1
|
|
4
|
+
data.tar.gz: 209256d417ff7c98c309b517cd7076a9743ea00de79124b6bec3e735a49a5238
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 88ccf91cbccb01f15ec513e232d48832e69a0ec9f5153992e91eab56c44183f10a10dc2a4bcd894509708ab97461b4698ecb73485da8d7dfa8826196837e0c3d
|
|
7
|
+
data.tar.gz: 80b0c3ec21c9444dedb05c1c1060035cdd0d5f0f731635ae79e4738c0a0d23c6fbf4ac67d48c6bb0ea70a76ee7e825a05a2afaaad95e8d2be54096636e0e2af0
|
data/app/models/assignment.rb
CHANGED
|
@@ -18,16 +18,12 @@ module WithExpectations
|
|
|
18
18
|
self[:expectations] = expectations.map(&:stringify_keys)
|
|
19
19
|
end
|
|
20
20
|
|
|
21
|
-
def
|
|
21
|
+
def raw_expectations
|
|
22
22
|
self[:expectations]
|
|
23
23
|
end
|
|
24
24
|
|
|
25
|
-
def own_custom_expectations
|
|
26
|
-
self[:custom_expectations]
|
|
27
|
-
end
|
|
28
|
-
|
|
29
25
|
def ensure_expectations_format
|
|
30
|
-
errors.add :
|
|
31
|
-
:invalid_format unless
|
|
26
|
+
errors.add :raw_expectations,
|
|
27
|
+
:invalid_format unless raw_expectations.to_a.all? { |it| Mulang::Expectation.valid? it }
|
|
32
28
|
end
|
|
33
29
|
end
|
data/app/models/exercise.rb
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
class Exercise < ApplicationRecord
|
|
2
|
-
RANDOMIZED_FIELDS = [:default_content, :description, :extra, :hint, :test]
|
|
2
|
+
RANDOMIZED_FIELDS = [:default_content, :description, :extra, :hint, :test, :expectations, :custom_expectations]
|
|
3
3
|
BASIC_RESOURCE_FIELDS = %i(
|
|
4
4
|
name layout editor corollary teacher_info manual_evaluation locale
|
|
5
5
|
choices assistance_rules randomizations tag_list extra_visible goal
|
|
@@ -135,8 +135,6 @@ class Exercise < ApplicationRecord
|
|
|
135
135
|
language_resource_h = language.to_embedded_resource_h if language != guide.language
|
|
136
136
|
as_json(only: BASIC_RESOURCE_FIELDS)
|
|
137
137
|
.merge(id: bibliotheca_id, language: language_resource_h, type: type.underscore)
|
|
138
|
-
.merge(expectations: self[:expectations])
|
|
139
|
-
.merge(custom_expectations: self[:custom_expectations])
|
|
140
138
|
.merge(settings: self[:settings])
|
|
141
139
|
.merge(RANDOMIZED_FIELDS.map { |it| [it, self[it]] }.to_h)
|
|
142
140
|
.symbolize_keys
|
|
@@ -239,8 +237,8 @@ class Exercise < ApplicationRecord
|
|
|
239
237
|
guide.pending_exercises(user)
|
|
240
238
|
end
|
|
241
239
|
|
|
242
|
-
def
|
|
243
|
-
is_a? ::
|
|
240
|
+
def solvable?
|
|
241
|
+
is_a? ::Problem
|
|
244
242
|
end
|
|
245
243
|
|
|
246
244
|
private
|
|
@@ -21,20 +21,15 @@ class Problem < QueriableChallenge
|
|
|
21
21
|
self.expectations = []
|
|
22
22
|
end
|
|
23
23
|
|
|
24
|
+
alias_method :own_expectations, :expectations
|
|
25
|
+
alias_method :own_custom_expectations, :custom_expectations
|
|
26
|
+
|
|
24
27
|
def expectations
|
|
25
|
-
own_expectations +
|
|
28
|
+
own_expectations + guide.expectations
|
|
26
29
|
end
|
|
27
30
|
|
|
28
31
|
def custom_expectations
|
|
29
|
-
"#{own_custom_expectations}\n#{
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
def guide_expectations
|
|
33
|
-
guide.expectations
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
def guide_custom_expectations
|
|
37
|
-
guide.custom_expectations
|
|
32
|
+
"#{own_custom_expectations}\n#{guide.custom_expectations}"
|
|
38
33
|
end
|
|
39
34
|
|
|
40
35
|
def evaluation_criteria?
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
require_relative './extensions/string'
|
|
2
|
+
require_relative './extensions/symbol'
|
|
2
3
|
require_relative './extensions/array'
|
|
3
4
|
require_relative './extensions/module'
|
|
4
5
|
require_relative './extensions/hash'
|
|
6
|
+
require_relative './extensions/nil'
|
|
5
7
|
require_relative './extensions/time'
|
|
@@ -59,15 +59,8 @@ class String
|
|
|
59
59
|
def sanitized
|
|
60
60
|
Mumukit::ContentType::Sanitizer.sanitize self
|
|
61
61
|
end
|
|
62
|
-
end
|
|
63
|
-
|
|
64
|
-
class NilClass
|
|
65
|
-
def affable
|
|
66
|
-
end
|
|
67
62
|
|
|
68
|
-
def
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
def sanitized
|
|
63
|
+
def randomize_with(randomizer, seed)
|
|
64
|
+
randomizer.randomize!(self, seed)
|
|
72
65
|
end
|
|
73
66
|
end
|
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.1.
|
|
4
|
+
version: 8.1.3
|
|
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-12-
|
|
11
|
+
date: 2020-12-18 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rails
|
|
@@ -656,7 +656,9 @@ files:
|
|
|
656
656
|
- lib/mumuki/domain/extensions/array.rb
|
|
657
657
|
- lib/mumuki/domain/extensions/hash.rb
|
|
658
658
|
- lib/mumuki/domain/extensions/module.rb
|
|
659
|
+
- lib/mumuki/domain/extensions/nil.rb
|
|
659
660
|
- lib/mumuki/domain/extensions/string.rb
|
|
661
|
+
- lib/mumuki/domain/extensions/symbol.rb
|
|
660
662
|
- lib/mumuki/domain/extensions/time.rb
|
|
661
663
|
- lib/mumuki/domain/factories.rb
|
|
662
664
|
- lib/mumuki/domain/factories/api_client_factory.rb
|