mumuki-laboratory 9.17.0 → 9.18.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/mumuki_laboratory/application/discussions.js +1 -0
- data/app/controllers/exam_authorization_requests_controller.rb +15 -14
- data/app/controllers/exam_registrations_controller.rb +1 -1
- data/app/helpers/exams_helper.rb +16 -6
- data/app/views/discussions/_message.html.erb +4 -0
- data/app/views/exam_registrations/show.html.erb +1 -1
- data/lib/mumuki/laboratory/locales/en.yml +1 -0
- data/lib/mumuki/laboratory/locales/es-CL.yml +1 -0
- data/lib/mumuki/laboratory/locales/es.yml +1 -0
- data/lib/mumuki/laboratory/locales/pt.yml +1 -0
- data/lib/mumuki/laboratory/version.rb +1 -1
- data/spec/controllers/exam_authorization_requests_controller_spec.rb +16 -2
- data/spec/dummy/db/schema.rb +2 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '0617268be6df9b74ff993247e4876c84492970ce49b6967db2aabb9ede077b5b'
|
4
|
+
data.tar.gz: 7c8387588bafd36583f3304f081401d91824fe8db75f023edefd4518d3c4e3f9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9aa1867aaa19195882d1eab24537353237354417dff78f134fce70790475d005b7e42fc7212a5420e41a6aa2d051ab6e107e8ea824363782406ffc98a435dc28
|
7
|
+
data.tar.gz: 05127705df408c4f031c4dd9c9b03a8685034fcc68b97ddd27d70aaaa87a85598c5dafebb7000fede11b3c8f09b9324b711a07d4362ca8518538d2912d118e6c
|
@@ -70,6 +70,7 @@ mumuki.load(() => {
|
|
70
70
|
discussionMessageToggleApprove: function (url, elem) {
|
71
71
|
Forum.discussionPost(url).done(function () {
|
72
72
|
elem.toggleClass("selected");
|
73
|
+
elem.attr('data-bs-original-title', '');
|
73
74
|
});
|
74
75
|
},
|
75
76
|
discussionMessageToggleNotActuallyAQuestion: function (url, elem) {
|
@@ -1,36 +1,37 @@
|
|
1
1
|
class ExamAuthorizationRequestsController < ApplicationController
|
2
2
|
|
3
|
-
before_action :
|
3
|
+
before_action :set_registration!
|
4
|
+
before_action :set_exam!
|
5
|
+
before_action :verify_registration_opened!
|
4
6
|
|
5
7
|
def create
|
6
|
-
authorization_request =
|
7
|
-
|
8
|
-
end
|
9
|
-
current_user.read_notification! authorization_request.exam_registration
|
8
|
+
authorization_request = @registration.request_authorization! current_user, @exam
|
9
|
+
current_user.read_notification! @registration
|
10
10
|
flash.notice = I18n.t :exam_authorization_request_created
|
11
11
|
redirect_to root_path
|
12
12
|
end
|
13
13
|
|
14
14
|
def update
|
15
|
-
|
15
|
+
@registration.update_authorization_request_by_id! params[:id], @exam
|
16
16
|
flash.notice = I18n.t :exam_authorization_request_saved
|
17
17
|
redirect_to root_path
|
18
18
|
end
|
19
19
|
|
20
20
|
private
|
21
21
|
|
22
|
-
def
|
23
|
-
|
22
|
+
def authorization_request_params
|
23
|
+
params.require(:exam_authorization_request).permit(:exam_id, :exam_registration_id)
|
24
24
|
end
|
25
25
|
|
26
|
-
def
|
27
|
-
|
28
|
-
|
29
|
-
|
26
|
+
def set_registration!
|
27
|
+
@registration = Organization.current.exam_registrations.find(authorization_request_params[:exam_registration_id])
|
28
|
+
end
|
29
|
+
|
30
|
+
def set_exam!
|
31
|
+
@exam = @registration.exams.find(authorization_request_params[:exam_id])
|
30
32
|
end
|
31
33
|
|
32
34
|
def verify_registration_opened!
|
33
|
-
|
34
|
-
raise Mumuki::Domain::GoneError if exam_registration.ended?
|
35
|
+
raise Mumuki::Domain::GoneError if @registration.ended?
|
35
36
|
end
|
36
37
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
class ExamRegistrationsController < ApplicationController
|
2
2
|
def show
|
3
|
-
@registration =
|
3
|
+
@registration = Organization.current.exam_registrations.find(params[:id])
|
4
4
|
@authorization_request = @registration.authorization_request_for(current_user)
|
5
5
|
end
|
6
6
|
end
|
data/app/helpers/exams_helper.rb
CHANGED
@@ -2,12 +2,8 @@ module ExamsHelper
|
|
2
2
|
def exam_information_for(user, exam)
|
3
3
|
%Q{
|
4
4
|
#{course_information_for(user, exam)}
|
5
|
-
#{
|
6
|
-
|
7
|
-
<br>
|
8
|
-
#{fa_icon(:stopwatch, class: 'fa-fw',
|
9
|
-
text: "<strong>#{t :available_time}:</strong> #{t :time_in_minutes, time: exam.duration}".html_safe)}
|
10
|
-
<br>
|
5
|
+
#{date_information_for(exam)}
|
6
|
+
#{duration_information_for(exam)}
|
11
7
|
}.html_safe
|
12
8
|
end
|
13
9
|
|
@@ -20,4 +16,18 @@ module ExamsHelper
|
|
20
16
|
<br>"
|
21
17
|
end
|
22
18
|
end
|
19
|
+
|
20
|
+
def date_information_for(exam)
|
21
|
+
"#{fa_icon('calendar-alt', class: 'fa-fw',
|
22
|
+
text: "<strong>#{t :date_and_time}:</strong> #{local_time_without_time_zone(exam.start_time)} - #{local_time(exam.end_time)}".html_safe)}
|
23
|
+
<br>"
|
24
|
+
end
|
25
|
+
|
26
|
+
def duration_information_for(exam)
|
27
|
+
if exam.duration?
|
28
|
+
"#{fa_icon(:stopwatch, class: 'fa-fw',
|
29
|
+
text: "<strong>#{t :available_time}:</strong> #{t :time_in_minutes, time: exam.duration}".html_safe)}
|
30
|
+
<br>"
|
31
|
+
end
|
32
|
+
end
|
23
33
|
end
|
@@ -13,6 +13,10 @@
|
|
13
13
|
<% if message.authorized?(current_user) && !message.deleted? %>
|
14
14
|
<% if current_user&.moderator_here? %>
|
15
15
|
<a class="discussion-message-approved <%= 'selected' if message.approved? %>"
|
16
|
+
<% if message.approved? && current_user&.forum_supervisor_here? %>
|
17
|
+
data-bs-toggle="tooltip" data-bs-placement="left"
|
18
|
+
title="<%= t :approved_by, validator: message.approved_by.name, date: local_time(message.approved_at) %>"
|
19
|
+
<% end %>
|
16
20
|
onclick="mumuki.Forum.discussionMessageToggleApprove('<%= approve_discussion_message_url(@discussion, message) %>', $(this))">
|
17
21
|
<%= fa_icon(:check, class: 'fa-lg') %>
|
18
22
|
</a>
|
@@ -25,7 +25,7 @@
|
|
25
25
|
<%= f.hidden_field :exam_registration_id, value: @registration.id %>
|
26
26
|
<div class="mb-4">
|
27
27
|
<%= f.label :exam_id, t(:exam_registration_choose_exam) %>
|
28
|
-
<% @registration.
|
28
|
+
<% @registration.available_exams.each do |exam| %>
|
29
29
|
<div class="form-check">
|
30
30
|
<%= f.radio_button(:exam_id, exam.id, id: exam.id, required: true, class: 'form-check-input mu-read-only-input',
|
31
31
|
checked: @authorization_request.exam_id == exam.id) %>
|
@@ -13,6 +13,7 @@ en:
|
|
13
13
|
all: All
|
14
14
|
appendix: Appendix
|
15
15
|
appendix_teaser: Do you want to learn more? <a href="%{link}">Check this chapter's appendix</a>"
|
16
|
+
approved_by: Validated by %{validator} at %{date}
|
16
17
|
approved_message: Validated by mentor
|
17
18
|
approved_messages:
|
18
19
|
other: validated
|
@@ -11,6 +11,7 @@ es-CL:
|
|
11
11
|
and: y
|
12
12
|
appendix: Apéndice
|
13
13
|
appendix_teaser: ¿Quieres saber más? <a href="%{link}">Consulta el apéndice de este capítulo</a>
|
14
|
+
approved_by: Validado por %{validator} el %{date}
|
14
15
|
approved_message: Validado por mentorías
|
15
16
|
approved_messages:
|
16
17
|
one: validado
|
@@ -14,6 +14,7 @@ es:
|
|
14
14
|
and: y
|
15
15
|
appendix: Apéndice
|
16
16
|
appendix_teaser: ¿Querés saber más? <a href="%{link}">Consultá el apéndice de este capítulo</a>
|
17
|
+
approved_by: Validado por %{validator} el %{date}
|
17
18
|
approved_message: Validado por mentorías
|
18
19
|
approved_messages:
|
19
20
|
one: validado
|
@@ -13,6 +13,7 @@ pt:
|
|
13
13
|
and: e
|
14
14
|
appendix: Apêndice
|
15
15
|
appendix_teaser: Você quer saber mais? <a href="%{link}"> Consulte o apêndice deste capítulo </a>
|
16
|
+
approved_by: Validado pelo %{validator} em %{date}
|
16
17
|
approved_message: Validado pelo mentor
|
17
18
|
approved_messages:
|
18
19
|
one: validado
|
@@ -3,7 +3,9 @@ require 'spec_helper'
|
|
3
3
|
describe ExamAuthorizationRequestsController, type: :controller, organization_workspace: :test do
|
4
4
|
let(:user) { create(:user) }
|
5
5
|
let(:exam) { create(:exam) }
|
6
|
-
let(:
|
6
|
+
let(:exam_id) { exam.id }
|
7
|
+
let(:organization) { Organization.current }
|
8
|
+
let(:exam_registration) { create(:exam_registration, exams: [exam], organization: organization) }
|
7
9
|
|
8
10
|
before { set_current_user! user }
|
9
11
|
|
@@ -12,12 +14,24 @@ describe ExamAuthorizationRequestsController, type: :controller, organization_wo
|
|
12
14
|
|
13
15
|
def do_post
|
14
16
|
post :create, params: {
|
15
|
-
exam_authorization_request: { exam_id:
|
17
|
+
exam_authorization_request: { exam_id: exam_id, exam_registration_id: exam_registration.id }
|
16
18
|
}
|
17
19
|
end
|
18
20
|
|
19
21
|
before { do_post }
|
20
22
|
|
23
|
+
describe 'called once in wrong organization' do
|
24
|
+
let(:organization) { create(:organization, name: 'other') }
|
25
|
+
it { expect(response.status).to eq 404 }
|
26
|
+
it { expect(exam_registration.authorization_requests.size).to be 0 }
|
27
|
+
end
|
28
|
+
|
29
|
+
describe 'called once with wrong exam' do
|
30
|
+
let(:exam_id) { create(:exam).id }
|
31
|
+
it { expect(response.status).to eq 404 }
|
32
|
+
it { expect(exam_registration.authorization_requests.size).to be 0 }
|
33
|
+
end
|
34
|
+
|
21
35
|
describe 'called once' do
|
22
36
|
it { expect(response.status).to eq 302 }
|
23
37
|
it { expect(exam_registration.authorization_requests.size).to be 1 }
|
data/spec/dummy/db/schema.rb
CHANGED
@@ -10,7 +10,7 @@
|
|
10
10
|
#
|
11
11
|
# It's strongly recommended that you check this file into your version control system.
|
12
12
|
|
13
|
-
ActiveRecord::Schema.define(version:
|
13
|
+
ActiveRecord::Schema.define(version: 20210929223144) do
|
14
14
|
|
15
15
|
# These are extensions that must be enabled in order to support this database
|
16
16
|
enable_extension "plpgsql"
|
@@ -194,6 +194,7 @@ ActiveRecord::Schema.define(version: 20210803175124) do
|
|
194
194
|
t.datetime "created_at", null: false
|
195
195
|
t.datetime "updated_at", null: false
|
196
196
|
t.boolean "processed", default: false
|
197
|
+
t.integer "authorization_requests_limit"
|
197
198
|
t.index ["organization_id"], name: "index_exam_registrations_on_organization_id"
|
198
199
|
end
|
199
200
|
|
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: 9.
|
4
|
+
version: 9.18.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: 2021-09-
|
11
|
+
date: 2021-09-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 9.
|
33
|
+
version: 9.18.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 9.
|
40
|
+
version: 9.18.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: mumukit-bridge
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|