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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d420aa36a1219b0a8984fa03062704f55b6227b0f8009ec7fa08b8c67d0780d6
4
- data.tar.gz: 0e0d9d6aab2633b8081464b447a90db3be572ab5ec3f9dad92d77e3824c71ade
3
+ metadata.gz: '0617268be6df9b74ff993247e4876c84492970ce49b6967db2aabb9ede077b5b'
4
+ data.tar.gz: 7c8387588bafd36583f3304f081401d91824fe8db75f023edefd4518d3c4e3f9
5
5
  SHA512:
6
- metadata.gz: '084ffe85c17ed01338fa6ad45bfb6a24b92ec85c838432626436b216c9486b49babac048883ce1a40dd20336ebdb745bf3182d82c681c2d29b7306f6b9a9e783'
7
- data.tar.gz: bfb035582b7227797d88fc2f66dd9912d6366f32d5b4428cee0e90a9d2c698f3b2989d2c60cf75d51570e3709f10bafb47fcc32db4cc819fd891c29a0a37167c
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 :verify_registration_opened!, on: [:create, :update]
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 = ExamAuthorizationRequest.find_or_create_by! create_authorization_request_params do |it|
7
- it.assign_attributes authorization_request_params
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
- ExamAuthorizationRequest.update params[:id], authorization_request_params
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 create_authorization_request_params
23
- authorization_request_params.slice :exam_registration_id, :user, :organization
22
+ def authorization_request_params
23
+ params.require(:exam_authorization_request).permit(:exam_id, :exam_registration_id)
24
24
  end
25
25
 
26
- def authorization_request_params
27
- params
28
- .require(:exam_authorization_request).permit(:exam_id, :exam_registration_id)
29
- .merge(user: current_user, organization: Organization.current)
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
- exam_registration = ExamRegistration.find(authorization_request_params[:exam_registration_id])
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 = ExamRegistration.find(params[:id])
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
@@ -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
- #{fa_icon('calendar-alt', class: 'fa-fw',
6
- text: "<strong>#{t :date_and_time}:</strong> #{local_time_without_time_zone(exam.start_time)} - #{local_time(exam.end_time)}".html_safe)}
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.exams.each do |exam| %>
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
@@ -1,5 +1,5 @@
1
1
  module Mumuki
2
2
  module Laboratory
3
- VERSION = '9.17.0'
3
+ VERSION = '9.18.0'
4
4
  end
5
5
  end
@@ -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(:exam_registration) { create(:exam_registration, exams: [exam]) }
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: exam.id, exam_registration_id: exam_registration.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 }
@@ -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: 20210803175124) do
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.17.0
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-23 00:00:00.000000000 Z
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.17.0
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.17.0
40
+ version: 9.18.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: mumukit-bridge
43
43
  requirement: !ruby/object:Gem::Requirement