mumuki-laboratory 5.2.1 → 5.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/invitations_controller.rb +1 -0
- data/app/helpers/exercise_input_helper.rb +4 -0
- data/app/models/concerns/with_assignments.rb +1 -4
- data/app/models/exercise.rb +4 -0
- data/app/models/language.rb +4 -0
- data/app/models/status_rendering_verbosity.rb +2 -6
- data/app/models/user.rb +14 -0
- data/app/views/exercises/show.html.erb +1 -1
- data/app/views/layouts/exercise_inputs/editors/_custom.html.erb +0 -1
- data/lib/mumuki/laboratory/version.rb +1 -1
- data/spec/models/assignment_spec.rb +11 -3
- data/spec/models/user_spec.rb +18 -0
- data/spec/models/verbosity_spec.rb +4 -3
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2274f31d946435025a018f54c3a83f962a6574d675e1e060712bdc9e78d5c281
|
4
|
+
data.tar.gz: 0a86aa34f9ee2422f41ac9062498f3d925740562a33e3eb5e6bc57239897a8d0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4a73e4420c07b9ee520922d3f1ffcfa5425abc7e5f8fa3bf8311a95664b7b3e50f44faf3f7ab9b4730fcd37cde58332eaa0d9f2dbec7f4e485283212c307361d
|
7
|
+
data.tar.gz: 68e1afc05bf48733ec13e5d1451e35beaf8c7d862197b4f7efe0dabd9ec31001c9afb6ef8c153b415f4cad00c400b8de64fbc960509b929afd189eeb07e0b920
|
@@ -11,6 +11,10 @@ module ExerciseInputHelper
|
|
11
11
|
render "layouts/exercise_inputs/editors/#{exercise.editor}", form: form, exercise: exercise
|
12
12
|
end
|
13
13
|
|
14
|
+
def default_content_tag_id(exercise)
|
15
|
+
exercise.custom? ? 'mu-custom-editor-default-value' : 'default_content'
|
16
|
+
end
|
17
|
+
|
14
18
|
def should_render_problem_tabs?(exercise, user)
|
15
19
|
!exercise.hidden? && (exercise.queriable? || exercise.extra_visible? || exercise.has_messages_for?(user))
|
16
20
|
end
|
@@ -19,10 +19,7 @@ module WithAssignments
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def interpolate_for(user, field)
|
22
|
-
language
|
23
|
-
.directives_interpolations
|
24
|
-
.interpolate(field, lambda { |content| replace_content_reference(user, content) })
|
25
|
-
.first
|
22
|
+
language.interpolate(field, user.interpolations, lambda { |content| replace_content_reference(user, content) })
|
26
23
|
end
|
27
24
|
|
28
25
|
def default_content_for(user)
|
data/app/models/exercise.rb
CHANGED
data/app/models/language.rb
CHANGED
@@ -65,6 +65,10 @@ class Language < ApplicationRecord
|
|
65
65
|
new_directive Mumukit::Directives::Sections
|
66
66
|
end
|
67
67
|
|
68
|
+
def interpolate(interpolee, *interpolations)
|
69
|
+
interpolations.inject(interpolee) { |content, interpolation| directives_interpolations.interpolate(content, interpolation).first }
|
70
|
+
end
|
71
|
+
|
68
72
|
def directives_interpolations
|
69
73
|
new_directive Mumukit::Directives::Interpolations
|
70
74
|
end
|
@@ -18,12 +18,8 @@ module StatusRenderingVerbosity
|
|
18
18
|
end
|
19
19
|
|
20
20
|
module Standard
|
21
|
-
def self.visible_expectation_results(
|
22
|
-
|
23
|
-
[]
|
24
|
-
else
|
25
|
-
expectation_results.select { |it| it[:result].failed? }
|
26
|
-
end
|
21
|
+
def self.visible_expectation_results(_status_like, expectation_results)
|
22
|
+
expectation_results.select { |it| it[:result].failed? }
|
27
23
|
end
|
28
24
|
|
29
25
|
def self.render_feedback?(feedback)
|
data/app/models/user.rb
CHANGED
@@ -116,6 +116,20 @@ class User < ApplicationRecord
|
|
116
116
|
where(uid: user[:uid]).first_or_create(user)
|
117
117
|
end
|
118
118
|
|
119
|
+
def interpolations
|
120
|
+
{
|
121
|
+
'user_email' => email,
|
122
|
+
'user_first_name' => first_name,
|
123
|
+
'user_last_name' => last_name
|
124
|
+
}
|
125
|
+
end
|
126
|
+
|
127
|
+
def resubmit!(organization = nil)
|
128
|
+
organization = Organization.find_by_name(organization) || main_organization
|
129
|
+
organization.switch!
|
130
|
+
assignments.each { |it| it.notify! rescue nil }
|
131
|
+
end
|
132
|
+
|
119
133
|
private
|
120
134
|
|
121
135
|
def set_uid!
|
@@ -59,7 +59,7 @@
|
|
59
59
|
|
60
60
|
<%= render_exercise_input_layout(@exercise) %>
|
61
61
|
|
62
|
-
<%= hidden_field_tag
|
62
|
+
<%= hidden_field_tag default_content_tag_id(@exercise), @default_content %>
|
63
63
|
|
64
64
|
<div style="display: none" id="processing-template">
|
65
65
|
<div class="bs-callout bs-callout-info">
|
@@ -2,5 +2,4 @@
|
|
2
2
|
|
3
3
|
<%= render_custom_editor(@exercise) %>
|
4
4
|
<%= form.hidden_field :content, id: "mu-custom-editor-value", value: @current_content %>
|
5
|
-
<%= form.hidden_field :default_content, id: "mu-custom-editor-default-value", value: @exercise.default_content %>
|
6
5
|
<%= form.hidden_field :content_extra, id: "mu-custom-editor-extra", value: @exercise.extra %>
|
@@ -61,13 +61,13 @@ describe Assignment, organization_workspace: :test do
|
|
61
61
|
describe '#expectation_results_visible?' do
|
62
62
|
let(:haskell) { create(:language, visible_success_output: true) }
|
63
63
|
let(:exercise) { create(:exercise) }
|
64
|
-
context 'should show expectation' do
|
64
|
+
context 'should show expectation with failed submissions' do
|
65
65
|
let(:failed_submission) { create(:assignment, status: :failed, expectation_results: [{:binding => "foo", :inspection => "HasBinding", :result => :failed}]) }
|
66
66
|
it { expect(failed_submission.expectation_results_visible?).to be true }
|
67
67
|
end
|
68
|
-
context 'should
|
68
|
+
context 'should show expectation with errored submissions' do
|
69
69
|
let(:errored_submission) { create(:assignment, status: :errored, expectation_results: [{:binding => "foo", :inspection => "HasBinding", :result => :failed}]) }
|
70
|
-
it { expect(errored_submission.expectation_results_visible?).to be
|
70
|
+
it { expect(errored_submission.expectation_results_visible?).to be true }
|
71
71
|
end
|
72
72
|
end
|
73
73
|
describe '#run_update!' do
|
@@ -163,4 +163,12 @@ describe Assignment, organization_workspace: :test do
|
|
163
163
|
it { expect(evaluated_assignment.manual_evaluation_comment).to eq '**Good**' }
|
164
164
|
end
|
165
165
|
|
166
|
+
describe '#extra' do
|
167
|
+
let(:user) { create(:user, email: 'some_email', first_name: 'some_first_name', last_name: 'some_last_name') }
|
168
|
+
let(:exercise) { create(:exercise, extra: "/*...user_email...*/\n/*...user_first_name...*/\n/*...user_last_name...*/") }
|
169
|
+
let(:assignment) { exercise.submit_solution!(user, content: '') }
|
170
|
+
|
171
|
+
it { expect(assignment.extra).to eq "some_email\nsome_first_name\nsome_last_name\n" }
|
172
|
+
end
|
173
|
+
|
166
174
|
end
|
data/spec/models/user_spec.rb
CHANGED
@@ -234,4 +234,22 @@ describe User, organization_workspace: :test do
|
|
234
234
|
|
235
235
|
end
|
236
236
|
end
|
237
|
+
|
238
|
+
describe '#resubmit!' do
|
239
|
+
let(:student) { create :user }
|
240
|
+
let(:exercises) { FactoryBot.create_list(:exercise, 5) }
|
241
|
+
|
242
|
+
let!(:chapter) {
|
243
|
+
create(:chapter, lessons: [
|
244
|
+
create(:lesson, exercises: exercises)]) }
|
245
|
+
|
246
|
+
before { reindex_current_organization! }
|
247
|
+
|
248
|
+
before { exercises.each { |it| it.submit_solution! student, content: '' } }
|
249
|
+
|
250
|
+
it do
|
251
|
+
student.assignments.each { |it| expect(it).to receive(:notify!).once }
|
252
|
+
student.resubmit! Organization.current.name
|
253
|
+
end
|
254
|
+
end
|
237
255
|
end
|
@@ -9,9 +9,10 @@ describe StatusRenderingVerbosity do
|
|
9
9
|
end
|
10
10
|
|
11
11
|
describe StatusRenderingVerbosity::Standard do
|
12
|
-
|
13
|
-
|
14
|
-
it { expect(StatusRenderingVerbosity::Standard.visible_expectation_results(:
|
12
|
+
let (:failed_expectations) { [{result: :failed, inspection: 'HasBinding', binding: 'bar'}] }
|
13
|
+
|
14
|
+
it { expect(StatusRenderingVerbosity::Standard.visible_expectation_results(:passed_with_warnings, results)).to eq failed_expectations }
|
15
|
+
it { expect(StatusRenderingVerbosity::Standard.visible_expectation_results(:errored, results)).to eq failed_expectations }
|
15
16
|
end
|
16
17
|
|
17
18
|
describe StatusRenderingVerbosity::Silent do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mumuki-laboratory
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.
|
4
|
+
version: 5.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Franco Bulgarelli
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-05-
|
11
|
+
date: 2018-05-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -931,7 +931,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
931
931
|
version: '0'
|
932
932
|
requirements: []
|
933
933
|
rubyforge_project:
|
934
|
-
rubygems_version: 2.7.
|
934
|
+
rubygems_version: 2.7.7
|
935
935
|
signing_key:
|
936
936
|
specification_version: 4
|
937
937
|
summary: Code assement web application for the Mumuki Platform.
|