mumuki-domain 6.1.3 → 6.1.4
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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bb99fbaf15499ef0b00d1767fa05b708ad0c216c
|
4
|
+
data.tar.gz: a71ee03b993434f5a2e95d64036868aca0f06270
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 522983d0523374e99da3cf410ff620cc3f6c570a7b7487d1ace5e4467c46f7144a34da2d4ecdf962cfbf1e394c1984ecdc9f37a3b3de2a44682a53a9989bfdd0
|
7
|
+
data.tar.gz: 11ab111e86471b8b777d8e0736fe5decf56102a612fcf13986c465e6dc8bae92f421d00c03e601b22c6aab2a7733ec7e9b81a95347713df160de3c9f59e3bc37
|
data/app/models/assignment.rb
CHANGED
@@ -65,7 +65,7 @@ class Assignment < ApplicationRecord
|
|
65
65
|
|
66
66
|
def content=(content)
|
67
67
|
if content.present?
|
68
|
-
self.solution = exercise.single_choice? ? exercise.
|
68
|
+
self.solution = exercise.single_choice? ? exercise.choice_index_for(content) : content
|
69
69
|
end
|
70
70
|
end
|
71
71
|
|
data/app/models/exercise.rb
CHANGED
@@ -19,6 +19,7 @@ class Exercise < ApplicationRecord
|
|
19
19
|
belongs_to :guide
|
20
20
|
defaults { self.submissions_count = 0 }
|
21
21
|
|
22
|
+
serialize :choices, Array
|
22
23
|
validates_presence_of :submissions_count,
|
23
24
|
:guide, :bibliotheca_id
|
24
25
|
|
@@ -85,7 +86,7 @@ class Exercise < ApplicationRecord
|
|
85
86
|
reset!
|
86
87
|
|
87
88
|
attrs = whitelist_attributes(resource_h, except: [:type, :id])
|
88
|
-
attrs[:choices] = resource_h[:choices]
|
89
|
+
attrs[:choices] = resource_h[:choices].to_a
|
89
90
|
attrs[:bibliotheca_id] = resource_h[:id]
|
90
91
|
attrs[:number] = number
|
91
92
|
attrs[:manual_evaluation] ||= false
|
@@ -95,6 +96,14 @@ class Exercise < ApplicationRecord
|
|
95
96
|
save!
|
96
97
|
end
|
97
98
|
|
99
|
+
def choice_values
|
100
|
+
self[:choice_values].presence || choices.map { |it| it.indifferent_get(:value) }
|
101
|
+
end
|
102
|
+
|
103
|
+
def choice_index_for(value)
|
104
|
+
choice_values.index(value)
|
105
|
+
end
|
106
|
+
|
98
107
|
def to_resource_h
|
99
108
|
language_resource_h = language.to_embedded_resource_h if language != guide.language
|
100
109
|
as_json(only: %i(name layout editor description corollary teacher_info hint test manual_evaluation locale extra
|
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.1.
|
4
|
+
version: 6.1.4
|
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-11-
|
11
|
+
date: 2018-11-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -86,14 +86,14 @@ dependencies:
|
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: '1.
|
89
|
+
version: '1.11'
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: '1.
|
96
|
+
version: '1.11'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: mumukit-directives
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -500,6 +500,7 @@ files:
|
|
500
500
|
- db/migrate/20181113183935_rename_guide_contributors_to_collaborators.rb
|
501
501
|
- db/migrate/20181114201620_add_test_template_to_languages.rb
|
502
502
|
- db/migrate/20181117190241_add_feedback_to_language.rb
|
503
|
+
- db/migrate/20181121165956_rename_choices_column.rb
|
503
504
|
- lib/mumuki/domain.rb
|
504
505
|
- lib/mumuki/domain/engine.rb
|
505
506
|
- lib/mumuki/domain/evaluation.rb
|