mumuki-domain 9.0.2 → 9.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/assignment.rb +2 -2
- data/app/models/course.rb +21 -1
- data/app/models/discussion.rb +1 -1
- data/app/models/exercise.rb +13 -0
- data/app/models/guide.rb +1 -10
- data/app/models/invitation.rb +1 -1
- data/app/models/topic.rb +7 -12
- data/app/models/user.rb +1 -1
- data/db/migrate/20210301210530_add_period_start_and_end_to_course.rb +7 -0
- data/lib/mumuki/domain/organization/settings.rb +2 -2
- data/lib/mumuki/domain/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 07771f9e0e712988ad05c336cabef30fea9af24bbfd6da99dc48d7ab19aee1ba
|
4
|
+
data.tar.gz: 52c848e349daf6f371daf73d5ef675c06af6da0eee19ce25f6329db5ff5a9383
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 556d16f80533171f7e67f9652f84c955a5d9f8d7efdd981ec7b141afb845f4bb880c391486c2a5f2adad434410c0a789a1552b0dd1019d22b24ee149d335c1e7
|
7
|
+
data.tar.gz: 00cbc6852719e47a496f2bb2569cd98db9499df559bc9958ca6e482b3ece6c03498540b65cb38c8e0bee813c70e10eeca7ed2c87fc70c80d1a59bc9b407efee0
|
data/app/models/assignment.rb
CHANGED
@@ -275,11 +275,11 @@ class Assignment < Progress
|
|
275
275
|
|
276
276
|
def update_submissions_count!
|
277
277
|
self.class.connection.execute(
|
278
|
-
"update
|
278
|
+
"update exercises
|
279
279
|
set submissions_count = submissions_count + 1
|
280
280
|
where id = #{exercise.id}")
|
281
281
|
self.class.connection.execute(
|
282
|
-
"update
|
282
|
+
"update assignments
|
283
283
|
set submissions_count = submissions_count + 1
|
284
284
|
where id = #{id}")
|
285
285
|
exercise.reload
|
data/app/models/course.rb
CHANGED
@@ -11,7 +11,7 @@ class Course < ApplicationRecord
|
|
11
11
|
|
12
12
|
alias_attribute :name, :code
|
13
13
|
|
14
|
-
resource_fields :slug, :shifts, :code, :days, :period, :description
|
14
|
+
resource_fields :slug, :shifts, :code, :days, :period, :description, :period_start, :period_end
|
15
15
|
|
16
16
|
def current_invitation
|
17
17
|
invitations.where('expiration_date > ?', Time.now).first
|
@@ -35,6 +35,26 @@ class Course < ApplicationRecord
|
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
38
|
+
def ended?
|
39
|
+
period_end.present? && period_end.past?
|
40
|
+
end
|
41
|
+
|
42
|
+
def started?
|
43
|
+
period_start.present? && period_start.past?
|
44
|
+
end
|
45
|
+
|
46
|
+
def infer_period_range!
|
47
|
+
return if period_start || period_end
|
48
|
+
|
49
|
+
period =~ /^(\d{4})?/
|
50
|
+
year = $1.to_i
|
51
|
+
|
52
|
+
return nil unless year.between? 2014, (DateTime.now.year + 1)
|
53
|
+
|
54
|
+
self.period_start = DateTime.new(year).beginning_of_year
|
55
|
+
self.period_end = DateTime.new(year).end_of_year
|
56
|
+
end
|
57
|
+
|
38
58
|
def canonical_code
|
39
59
|
"#{period}-#{code}".downcase
|
40
60
|
end
|
data/app/models/discussion.rb
CHANGED
@@ -167,7 +167,7 @@ class Discussion < ApplicationRecord
|
|
167
167
|
end
|
168
168
|
|
169
169
|
def being_accessed_by_moderator?
|
170
|
-
last_moderator_access_at.present? && last_moderator_access_at
|
170
|
+
last_moderator_access_at.present? && last_moderator_access_at.future? - MODERATOR_REVIEW_AVERAGE_TIME
|
171
171
|
end
|
172
172
|
|
173
173
|
def last_moderator_access_visible_for?(user)
|
data/app/models/exercise.rb
CHANGED
@@ -267,4 +267,17 @@ class Exercise < ApplicationRecord
|
|
267
267
|
def self.default_layout
|
268
268
|
layouts.keys[0]
|
269
269
|
end
|
270
|
+
|
271
|
+
def self.with_pending_assignments_for(user, relation)
|
272
|
+
relation.
|
273
|
+
joins("left join assignments assignments
|
274
|
+
on assignments.exercise_id = exercises.id
|
275
|
+
and assignments.submitter_id = #{user.id}
|
276
|
+
and assignments.organization_id = #{Organization.current.id}
|
277
|
+
and assignments.submission_status in (
|
278
|
+
#{Mumuki::Domain::Status::Submission::Passed.to_i},
|
279
|
+
#{Mumuki::Domain::Status::Submission::ManualEvaluationPending.to_i}
|
280
|
+
)").
|
281
|
+
where('assignments.id is null')
|
282
|
+
end
|
270
283
|
end
|
data/app/models/guide.rb
CHANGED
@@ -50,17 +50,8 @@ class Guide < Content
|
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
53
|
-
# TODO: Make use of pending_siblings logic
|
54
53
|
def pending_exercises(user)
|
55
|
-
exercises
|
56
|
-
joins("left join public.assignments assignments
|
57
|
-
on assignments.exercise_id = exercises.id
|
58
|
-
and assignments.submitter_id = #{user.id}
|
59
|
-
and assignments.submission_status in (
|
60
|
-
#{Mumuki::Domain::Status::Submission::Passed.to_i},
|
61
|
-
#{Mumuki::Domain::Status::Submission::ManualEvaluationPending.to_i}
|
62
|
-
)").
|
63
|
-
where('assignments.id is null')
|
54
|
+
Exercise.with_pending_assignments_for(user, exercises)
|
64
55
|
end
|
65
56
|
|
66
57
|
def first_exercise
|
data/app/models/invitation.rb
CHANGED
data/app/models/topic.rb
CHANGED
@@ -50,18 +50,13 @@ class Topic < Content
|
|
50
50
|
end
|
51
51
|
|
52
52
|
def pending_lessons(user)
|
53
|
-
|
54
|
-
.
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
and assignments.submission_status in (
|
61
|
-
#{Mumuki::Domain::Status::Submission::Passed.to_i},
|
62
|
-
#{Mumuki::Domain::Status::Submission::ManualEvaluationPending.to_i}
|
63
|
-
)")
|
64
|
-
.where('assignments.id is null')
|
53
|
+
Exercise
|
54
|
+
.with_pending_assignments_for(
|
55
|
+
user,
|
56
|
+
lessons
|
57
|
+
.includes(:guide)
|
58
|
+
.references(:guide)
|
59
|
+
.joins('left join exercises exercises on exercises.guide_id = guides.id'))
|
65
60
|
.group('guides.id', 'lessons.number', 'lessons.id')
|
66
61
|
end
|
67
62
|
|
data/app/models/user.rb
CHANGED
@@ -223,7 +223,7 @@ class User < ApplicationRecord
|
|
223
223
|
end
|
224
224
|
|
225
225
|
def next_exercise_at(guide)
|
226
|
-
guide.pending_exercises(self).order('
|
226
|
+
guide.pending_exercises(self).order('exercises.number asc').first
|
227
227
|
end
|
228
228
|
|
229
229
|
def run_submission!(submission, assignment, evaluation)
|
@@ -40,10 +40,10 @@ class Mumuki::Domain::Organization::Settings < Mumukit::Platform::Model
|
|
40
40
|
end
|
41
41
|
|
42
42
|
def disabled?
|
43
|
-
disabled_from.present? && disabled_from
|
43
|
+
disabled_from.present? && disabled_from.past?
|
44
44
|
end
|
45
45
|
|
46
46
|
def in_preparation?
|
47
|
-
in_preparation_until.present? && in_preparation_until
|
47
|
+
in_preparation_until.present? && in_preparation_until.future?
|
48
48
|
end
|
49
49
|
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.0.
|
4
|
+
version: 9.0.3
|
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-03-
|
11
|
+
date: 2021-03-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -657,6 +657,7 @@ files:
|
|
657
657
|
- db/migrate/20210119174504_create_certificate_programs.rb
|
658
658
|
- db/migrate/20210119174835_create_certificates.rb
|
659
659
|
- db/migrate/20210119190204_create_exam_registration_exam_join_table.rb
|
660
|
+
- db/migrate/20210301210530_add_period_start_and_end_to_course.rb
|
660
661
|
- db/migrate/20210302181654_add_faqs_to_organizations.rb
|
661
662
|
- lib/mumuki/domain.rb
|
662
663
|
- lib/mumuki/domain/area.rb
|