mumuki-domain 6.2.0 → 6.2.1

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: ee36809b582014389c467d826cf8b882328db5ca64148dc86c61934de774cbb2
4
- data.tar.gz: a015be5b71a6cb6be0b3b7f40704e5c7c0ff8391fc8e45d08db51420c71d9522
3
+ metadata.gz: 76ce31380b9bb9748fa7bb45e294758326fe416a7e23f653ccd7685687b52d9e
4
+ data.tar.gz: fb574a1ed0d64dfc987e32cdab66878d590b1245eaf8b5ff043ffa859de371bd
5
5
  SHA512:
6
- metadata.gz: 9281ce11cfab651b7a7c2be4f4d528a7ac29278c19eff71116adcb376c21ec6059bb874412599398da47cbe4702f2ec0a8a55865cbe80decf21df85402ca442b
7
- data.tar.gz: 1183e2aeed8d70f425f1cc9751f95f987bfd7a8d88d0268bc6fe83983725f4f45b8ef03095b1d666b773e8964ad234355b7de4ef11eb4ca4d229764028b20164
6
+ metadata.gz: 909546a44435e5fdd0d93961e96cff5b96d8c5306e1b4d4bff4ef3b91dcb0425e8a411ce101c3bf3345e968c08e697ab0c8bcae5f5cf6e5d711850bcebe8bcb8
7
+ data.tar.gz: 926e48d33c8ec6c2433fa6ceb9a9c7fa68297f0e7d3d8a2cb57346e5461b7c104125b689afda72bb818b5b998e876581a92f557283cc8c69a10be3c015901ee9
@@ -1,4 +1,6 @@
1
1
  class Exercise < ApplicationRecord
2
+ RANDOMIZED_FIELDS = [:default_content, :description, :extra, :hint, :test]
3
+
2
4
  include WithDescription
3
5
  include WithLocale
4
6
  include WithNumber,
@@ -23,7 +25,7 @@ class Exercise < ApplicationRecord
23
25
  validates_presence_of :submissions_count,
24
26
  :guide, :bibliotheca_id
25
27
 
26
- randomize :description, :hint, :extra, :test, :default_content
28
+ randomize(*RANDOMIZED_FIELDS)
27
29
  delegate :timed?, to: :navigable_parent
28
30
 
29
31
  def console?
@@ -106,10 +108,12 @@ class Exercise < ApplicationRecord
106
108
 
107
109
  def to_resource_h
108
110
  language_resource_h = language.to_embedded_resource_h if language != guide.language
109
- as_json(only: %i(name layout editor description corollary teacher_info hint test manual_evaluation locale extra
110
- choices expectations assistance_rules randomizations tag_list extra_visible goal default_content
111
+ as_json(only: %i(name layout editor corollary teacher_info manual_evaluation locale
112
+ choices assistance_rules randomizations tag_list extra_visible goal
111
113
  free_form_editor_source initial_state final_state))
112
114
  .merge(id: bibliotheca_id, language: language_resource_h, type: type.underscore)
115
+ .merge(expectations: own_expectations)
116
+ .merge(RANDOMIZED_FIELDS.map { |it| [it, self[it]] }.to_h)
113
117
  .symbolize_keys
114
118
  .compact
115
119
  end
@@ -164,10 +168,6 @@ class Exercise < ApplicationRecord
164
168
  {}
165
169
  end
166
170
 
167
- def default_content
168
- self[:default_content] || ''
169
- end
170
-
171
171
  # Submits the user solution
172
172
  # only if the corresponding assignment has attemps left
173
173
  def try_submit_solution!(user, solution={})
@@ -75,6 +75,7 @@ class Language < ApplicationRecord
75
75
 
76
76
  # TODO we should use Mumukit::Directives::Pipeline
77
77
  def interpolate(interpolee, *interpolations)
78
+ interpolee = interpolee || ''
78
79
  interpolations.inject(interpolee) { |content, interpolation| directives_interpolations.interpolate(content, interpolation).first }
79
80
  end
80
81
 
@@ -1,5 +1,5 @@
1
1
  module Mumuki
2
2
  module Domain
3
- VERSION = '6.2.0'
3
+ VERSION = '6.2.1'
4
4
  end
5
5
  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: 6.2.0
4
+ version: 6.2.1
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: 2018-12-20 00:00:00.000000000 Z
11
+ date: 2018-12-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -618,7 +618,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
618
618
  - !ruby/object:Gem::Version
619
619
  version: '0'
620
620
  requirements: []
621
- rubygems_version: 3.0.0
621
+ rubygems_version: 3.0.1
622
622
  signing_key:
623
623
  specification_version: 4
624
624
  summary: Mumuki Platform's Domain Model