mumuki-domain 9.17.0 → 9.18.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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 58b906585eb037f9120720bf77a34555343051e1aa2c87636a86208604247c2d
|
|
4
|
+
data.tar.gz: ac72f7c3a8e36c388fe4cbf0c7e1e3a51620c9a2a6a333222a033dfa56ab3176
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 254fa485adb9816805590f4fc60877b8e1626f152d7e335e419ac5402079ec9bd4f30a5fd85cab712e694c10f8aeb0a9829d762bd1ec01323ccec9525981d930
|
|
7
|
+
data.tar.gz: 5ef6dd8ed07d02d17c9c6049371bcd50a1235e7958d9a68ea41940121ff72c2f81c17beb9b9a69b2b5d70fc4c811df0bd1181cd18ebc28efbd9676d922d8d1a1
|
data/app/models/exam.rb
CHANGED
|
@@ -76,6 +76,18 @@ class ExamRegistration < ApplicationRecord
|
|
|
76
76
|
authorization_criterion.meets_criterion?(user, organization)
|
|
77
77
|
end
|
|
78
78
|
|
|
79
|
+
def available_exams
|
|
80
|
+
return exams unless limited_authorization_requests?
|
|
81
|
+
counts = authorization_request_ids_counts
|
|
82
|
+
exams.select do |it|
|
|
83
|
+
counts[it.id].to_i < authorization_requests_limit
|
|
84
|
+
end
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
def limited_authorization_requests?
|
|
88
|
+
authorization_requests_limit.present?
|
|
89
|
+
end
|
|
90
|
+
|
|
79
91
|
def multiple_options?
|
|
80
92
|
exams.count > 1
|
|
81
93
|
end
|
|
@@ -84,9 +96,39 @@ class ExamRegistration < ApplicationRecord
|
|
|
84
96
|
end_time.past?
|
|
85
97
|
end
|
|
86
98
|
|
|
99
|
+
def request_authorization!(user, exam)
|
|
100
|
+
with_available_exam exam do
|
|
101
|
+
authorization_requests.find_or_create_by! user: user do |it|
|
|
102
|
+
it.assign_attributes organization: organization, exam: exam
|
|
103
|
+
end
|
|
104
|
+
end
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
def update_authorization_request_by_id!(request_id, exam)
|
|
108
|
+
with_available_exam exam do
|
|
109
|
+
authorization_requests.update request_id, exam: exam
|
|
110
|
+
end
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
def authorization_request_ids_counts
|
|
114
|
+
authorization_requests.group(:exam_id).count
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
def exam_available?(exam)
|
|
118
|
+
available_exams.include? exam
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
def with_available_exam(exam, &block)
|
|
122
|
+
transaction do
|
|
123
|
+
raise Mumuki::Domain::GoneError unless exam_available?(exam)
|
|
124
|
+
block.call
|
|
125
|
+
end
|
|
126
|
+
end
|
|
127
|
+
|
|
87
128
|
private
|
|
88
129
|
|
|
89
130
|
def notify_registree!(registree)
|
|
90
131
|
Notification.create_and_notify_via_email! organization: organization, user: registree, subject: :exam_registration, target: self
|
|
91
132
|
end
|
|
133
|
+
|
|
92
134
|
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: 9.
|
|
4
|
+
version: 9.18.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: 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
|
|
@@ -114,14 +114,14 @@ dependencies:
|
|
|
114
114
|
requirements:
|
|
115
115
|
- - "~>"
|
|
116
116
|
- !ruby/object:Gem::Version
|
|
117
|
-
version: '1.
|
|
117
|
+
version: '1.2'
|
|
118
118
|
type: :runtime
|
|
119
119
|
prerelease: false
|
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
|
121
121
|
requirements:
|
|
122
122
|
- - "~>"
|
|
123
123
|
- !ruby/object:Gem::Version
|
|
124
|
-
version: '1.
|
|
124
|
+
version: '1.2'
|
|
125
125
|
- !ruby/object:Gem::Dependency
|
|
126
126
|
name: mumukit-platform
|
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -686,6 +686,7 @@ files:
|
|
|
686
686
|
- db/migrate/20210707143002_add_assignment_id_to_message.rb
|
|
687
687
|
- db/migrate/20210719145706_add_new_fields_to_notifications.rb
|
|
688
688
|
- db/migrate/20210803175124_add_ignored_notifications_to_users.rb
|
|
689
|
+
- db/migrate/20210929223144_add_authorization_requests_limit_to_exam_registration.rb
|
|
689
690
|
- lib/mumuki/domain.rb
|
|
690
691
|
- lib/mumuki/domain/area.rb
|
|
691
692
|
- lib/mumuki/domain/engine.rb
|