mumuki-domain 6.0.4 → 6.1.2

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: ed9e82dd56783101526c2b4dcd7366d5a4ab2a9f
4
- data.tar.gz: a1a3a1838c41c06aa54502563cf87be6a2713f9b
3
+ metadata.gz: da368dc621be6d44c8beaf3911eddc67d17ef8fd
4
+ data.tar.gz: 63ccade9f6c8c2a5f738f89b968d1ee24bddb942
5
5
  SHA512:
6
- metadata.gz: 8ffaf2b407569be9c41a7535b9b9d66903d20c4a5c8e51a151d5438db7c3f74935942de081df520706872cb9b83cfd169f234d6abf3fe8dbdaa5beeaae3b6613
7
- data.tar.gz: 69295d1103a34b7914f0cdd3d7538f7b1b6594b667f510f83c36dcc71e4badefa475c9bba083e8b2322834c5d4508535e760a1567d06ff33526f9f64cba28142
6
+ metadata.gz: fd459b117c863d10d1cea2b547005c8b1d8a136e1ec35bd630bc7d5e3c2d3f8d52a41a0c3c1d6abe77518a136189348b73aff3b78e1c31beb921bc94b92c4b52
7
+ data.tar.gz: b97af1e26758a4d4af5cb5459191e5b8d2f0159699a5e42fd0aa509666ddafeb469b3c1ba5d297e9a88b28d0aaac6e43ee420d097e2fcd8624810dd5556c5f57
@@ -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.choice_index_for(content) : content
68
+ self.solution = exercise.single_choice? ? exercise.choices.index(content) : content
69
69
  end
70
70
  end
71
71
 
@@ -15,7 +15,7 @@ module WithEditor
15
15
  end
16
16
 
17
17
  def pretty_choices
18
- choice_values.each_with_index.map do |choice, index|
18
+ choices.each_with_index.map do |choice, index|
19
19
  struct id: "content_choice_#{index}",
20
20
  index: index,
21
21
  value: choice,
@@ -19,7 +19,6 @@ class Exercise < ApplicationRecord
19
19
  belongs_to :guide
20
20
  defaults { self.submissions_count = 0 }
21
21
 
22
- serialize :choices, Array
23
22
  validates_presence_of :submissions_count,
24
23
  :guide, :bibliotheca_id
25
24
 
@@ -86,7 +85,7 @@ class Exercise < ApplicationRecord
86
85
  reset!
87
86
 
88
87
  attrs = whitelist_attributes(resource_h, except: [:type, :id])
89
- attrs[:choices] = resource_h[:choices].to_a
88
+ attrs[:choices] = resource_h[:choices]&.map { |choice| choice[:value] }.to_a
90
89
  attrs[:bibliotheca_id] = resource_h[:id]
91
90
  attrs[:number] = number
92
91
  attrs[:manual_evaluation] ||= false
@@ -96,14 +95,6 @@ class Exercise < ApplicationRecord
96
95
  save!
97
96
  end
98
97
 
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
-
107
98
  def to_resource_h
108
99
  language_resource_h = language.to_embedded_resource_h if language != guide.language
109
100
  as_json(only: %i(name layout editor description corollary teacher_info hint test manual_evaluation locale extra
@@ -96,16 +96,6 @@ class Organization < ApplicationRecord
96
96
  report_issue_enabled? || community_link.present? || forum_enabled?
97
97
  end
98
98
 
99
- def self.import_from_resource_h!(resource_h)
100
- find_or_initialize_by(name: resource_h[:name]).tap { |it| it.import_from_resource_h! resource_h }
101
- end
102
-
103
- def import_from_resource_h!(resource_h)
104
- attrs = Mumukit::Platform::Organization::Helpers.slice_platform_json resource_h
105
- attrs[:book] = Book.locate_resource attrs[:book]
106
- update! attrs
107
- end
108
-
109
99
  private
110
100
 
111
101
  def ensure_consistent_public_login
@@ -1,5 +1,5 @@
1
1
  module Mumuki
2
2
  module Domain
3
- VERSION = '6.0.4'
3
+ VERSION = '6.1.2'
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.0.4
4
+ version: 6.1.2
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-30 00:00:00.000000000 Z
11
+ date: 2018-11-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '3.7'
61
+ version: '3.8'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '3.7'
68
+ version: '3.8'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: mumukit-content-type
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -86,14 +86,14 @@ dependencies:
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: '1.11'
89
+ version: '1.10'
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.11'
96
+ version: '1.10'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: mumukit-directives
99
99
  requirement: !ruby/object:Gem::Requirement
@@ -500,7 +500,6 @@ 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
504
503
  - lib/mumuki/domain.rb
505
504
  - lib/mumuki/domain/engine.rb
506
505
  - lib/mumuki/domain/evaluation.rb
@@ -1,6 +0,0 @@
1
- class RenameChoicesColumn < ActiveRecord::Migration[5.1]
2
- def change
3
- rename_column :exercises, :choices, :choice_values
4
- add_column :exercises, :choices, :text
5
- end
6
- end