mumuki-domain 7.3.2 → 7.4.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 39020a28808b40cdfdfcbbacb3f5548a56ba6886ae4ffec37e46501a9e211ae9
4
- data.tar.gz: 80eebf536803172e019da3af5e4e480e4613716db2dff9cb2bd51a09dee20340
3
+ metadata.gz: 565a262560be1187382a14821310b252774ddd2cfbff5b1ec27f4740009274a8
4
+ data.tar.gz: f81fcb7e631f8f4e1a88526a95a7152bb854c9cc8beea26cf0342574f68413e3
5
5
  SHA512:
6
- metadata.gz: 2b92101a2f8af04af9f29722c8581f645533da33146deb68b16af0013babfa86786f6210929ea4d42857cfdb1be871fd8671b76b210321a7c78110a02fbee750
7
- data.tar.gz: dcd486ae7a1cbe1500d2ad16b06856ee3ef5ee114ec5d54280754c1ad49c627eba0290f1af0b59d7a11a21e1df9313cdf5f948bef1849b180074c363399519a0
6
+ metadata.gz: 1f47711214119a25152f602e342ad9934d5e5e72253580639704353bdd9337aeba0899ad975c75d139363f5dfb13ed4574673df381d99896c766e14a9b79abc4
7
+ data.tar.gz: aab1d74be634268a51719ee81d9a3977ea0412b5b645a8e5b29909b75b690ad2deac25bed2e2872312dfa8b63c48fcf0b5516bd9731fcb50b7dd644d8c2c7fbd
@@ -18,7 +18,7 @@ class Assignment < Progress
18
18
  validates_presence_of :exercise, :submitter
19
19
 
20
20
  delegate :language, :name, :navigable_parent, :settings,
21
- :limited?, :input_kids?, :choice?, to: :exercise
21
+ :limited?, :input_kids?, :choice?, :results_hidden?, to: :exercise
22
22
 
23
23
  alias_attribute :status, :submission_status
24
24
  alias_attribute :attempts_count, :attemps_count
@@ -59,6 +59,14 @@ class Assignment < Progress
59
59
  update! status: teacher_evaluation[:status], manual_evaluation_comment: teacher_evaluation[:manual_evaluation]
60
60
  end
61
61
 
62
+ def visible_status
63
+ if results_hidden? && !pending?
64
+ :manual_evaluation_pending.to_submission_status
65
+ else
66
+ super
67
+ end
68
+ end
69
+
62
70
  def persist_submission!(submission)
63
71
  transaction do
64
72
  messages.destroy_all if submission_id.present?
@@ -190,7 +198,7 @@ class Assignment < Progress
190
198
  navigable_parent.attempts_left_for(self)
191
199
  end
192
200
 
193
- # Tells wether the submitter of this
201
+ # Tells whether the submitter of this
194
202
  # assignment can keep on sending submissions
195
203
  # which is true for non limited or for assignments
196
204
  # that have not reached their submissions limit
@@ -43,14 +43,22 @@ module Contextualization
43
43
  output_content_type.to_html test_results.first[:result]
44
44
  end
45
45
 
46
- def results_visible?
47
- (visible_success_output? || !passed?) && !exercise.choices? && !manual_evaluation_pending?
46
+ def results_body_hidden?
47
+ (passed? && !visible_success_output?) || exercise.choice? || manual_evaluation_pending?
48
48
  end
49
49
 
50
50
  def result_preview
51
51
  result.truncate(100) unless passed?
52
52
  end
53
53
 
54
+ def visible_status
55
+ status
56
+ end
57
+
58
+ def iconize
59
+ visible_status.iconize
60
+ end
61
+
54
62
  def result_html
55
63
  output_content_type.to_html(result)
56
64
  end
@@ -38,7 +38,13 @@ module GuideContainer
38
38
  # Tells if this guide container
39
39
  # imposes any kind of limit to the number of submission
40
40
  # to its assignments, which may depend on the exercise's type
41
- def limited_for?(exercise)
41
+ def limited_for?(_exercise)
42
+ false
43
+ end
44
+
45
+ # Tells if this guide container
46
+ # hides the results for students
47
+ def results_hidden_for?(_exercise)
42
48
  false
43
49
  end
44
50
 
@@ -161,6 +161,10 @@ class Exam < ApplicationRecord
161
161
  max_attempts_for(exercise).present?
162
162
  end
163
163
 
164
+ def results_hidden_for?(exercise)
165
+ exercise.choice? && results_hidden_for_choices?
166
+ end
167
+
164
168
  def resettable?
165
169
  false
166
170
  end
@@ -55,6 +55,10 @@ class Exercise < ApplicationRecord
55
55
  guide.done_for?(user)
56
56
  end
57
57
 
58
+ def choice?
59
+ false
60
+ end
61
+
58
62
  def previous
59
63
  sibling_at number.pred
60
64
  end
@@ -192,8 +196,15 @@ class Exercise < ApplicationRecord
192
196
  end
193
197
  end
194
198
 
199
+ # An exercise with hidden results cannot be limited
200
+ # as those exercises can be submitted as many times as the
201
+ # student wants because no result output is given
195
202
  def limited?
196
- navigable_parent.limited_for?(self)
203
+ !results_hidden? && navigable_parent.limited_for?(self)
204
+ end
205
+
206
+ def results_hidden?
207
+ navigable_parent&.results_hidden_for?(self)
197
208
  end
198
209
 
199
210
  def files_for(current_content)
@@ -0,0 +1,5 @@
1
+ class AddResultsHiddenForChoicesToExam < ActiveRecord::Migration[5.1]
2
+ def change
3
+ add_column :exams, :results_hidden_for_choices, :boolean, default: false
4
+ end
5
+ end
@@ -51,6 +51,13 @@ FactoryBot.define do
51
51
  test { 'dont care' }
52
52
  end
53
53
 
54
+ factory :multiple_choice, parent: :problem do
55
+ name { 'A multiple choice problem' }
56
+ editor { :multiple_choice }
57
+ description { 'Simple multiple choice problem' }
58
+ choices { [{value: 'a', checked: true}, {value: 'b', checked: false }] }
59
+ end
60
+
54
61
  factory :interactive, class: Interactive, parent: :challenge do
55
62
  name { 'An interactive problem' }
56
63
  description { 'Simple interactive problem' }
@@ -1,5 +1,5 @@
1
1
  module Mumuki
2
2
  module Domain
3
- VERSION = '7.3.2'
3
+ VERSION = '7.4.0'
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: 7.3.2
4
+ version: 7.4.0
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-04-01 00:00:00.000000000 Z
11
+ date: 2020-04-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -598,6 +598,7 @@ files:
598
598
  - db/migrate/20191217184525_add_progress_fields_to_indicators.rb
599
599
  - db/migrate/20200127142401_add_private_to_topics_and_books.rb
600
600
  - db/migrate/20200213175736_add_verified_names_to_users.rb
601
+ - db/migrate/20200312181842_add_results_hidden_for_choices_to_exam.rb
601
602
  - lib/mumuki/domain.rb
602
603
  - lib/mumuki/domain/engine.rb
603
604
  - lib/mumuki/domain/evaluation.rb