mumuki-domain 6.0.1 → 6.0.3
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: 0fad2ecd67525418ebd21e6b6b7bb9e190aa0221
|
4
|
+
data.tar.gz: afb33d70f417502e0077083012e9ad6eb0cbb4b8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e050c244b1937af8a0b78c18e0a69b0d2cf324b32bef213ea5dd0bd83cc657182605791e7927d43fc1f9ac6813b29915ed9cba2c2e15964bebf4bbe734223e53
|
7
|
+
data.tar.gz: 96c5eab7647489c35cc5b8d4e4f7d52b52a65c43aada24def22cc51477790147d997dcf0d55fa0a1af26c8b0c6f223fb4997488547f64df431ee70ebe47c2294
|
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.0.
|
4
|
+
version: 6.0.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: 2018-11-
|
11
|
+
date: 2018-11-22 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
|