mumuki-domain 7.4.1 → 7.7.0
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 +1 -1
- data/app/models/avatar.rb +5 -0
- data/app/models/book.rb +13 -0
- data/app/models/concerns/{with_content.rb → container.rb} +1 -1
- data/app/models/concerns/contextualization.rb +53 -2
- data/app/models/concerns/disabling.rb +37 -0
- data/app/models/concerns/guide_container.rb +1 -1
- data/app/models/concerns/submittable/solvable.rb +8 -2
- data/app/models/concerns/topic_container.rb +1 -1
- data/app/models/concerns/with_discussions.rb +8 -5
- data/app/models/concerns/with_editor.rb +1 -1
- data/app/models/concerns/with_layout.rb +5 -1
- data/app/models/concerns/with_progress.rb +4 -0
- data/app/models/concerns/with_scoped_queries.rb +9 -9
- data/app/models/concerns/with_scoped_queries/page.rb +1 -1
- data/app/models/concerns/with_scoped_queries/sort.rb +6 -1
- data/app/models/course.rb +18 -7
- data/app/models/discussion.rb +47 -9
- data/app/models/exam.rb +53 -23
- data/app/models/exam/passing_criterion.rb +53 -0
- data/app/models/exercise.rb +3 -3
- data/app/models/exercise/challenge.rb +1 -1
- data/app/models/exercise/problem.rb +6 -0
- data/app/models/exercise/reading.rb +4 -0
- data/app/models/guide.rb +1 -1
- data/app/models/invitation.rb +7 -1
- data/app/models/message.rb +28 -4
- data/app/models/organization.rb +16 -0
- data/app/models/user.rb +48 -3
- data/db/migrate/20200508191543_create_avatars.rb +8 -0
- data/db/migrate/20200518135658_add_avatar_to_users.rb +5 -0
- data/db/migrate/20200527180729_add_disabled_at_to_users.rb +6 -0
- data/db/migrate/20200601203033_add_course_to_exam.rb +5 -0
- data/db/migrate/20200605161350_add_passing_criterions_to_exam.rb +6 -0
- data/db/migrate/20200608132959_add_progressive_display_lookahead_to_organizations.rb +5 -0
- data/db/migrate/20200702165503_add_messages_count_to_discussion.rb +6 -0
- data/db/migrate/20200728162727_add_not_actually_a_question_field_to_messages.rb +5 -0
- data/db/migrate/20200728163038_add_requires_moderator_response_to_discussions.rb +5 -0
- data/db/migrate/20200731081757_add_last_moderator_access_fields_to_discussion.rb +6 -0
- data/lib/mumuki/domain.rb +2 -0
- data/lib/mumuki/domain/area.rb +13 -0
- data/lib/mumuki/domain/exceptions.rb +3 -0
- data/lib/mumuki/domain/exceptions/disabled_error.rb +2 -0
- data/lib/mumuki/domain/exceptions/disabled_organization_error.rb +2 -0
- data/lib/mumuki/domain/exceptions/unprepared_organization_error.rb +2 -0
- data/lib/mumuki/domain/extensions/hash.rb +11 -2
- data/lib/mumuki/domain/extensions/string.rb +44 -0
- data/lib/mumuki/domain/factories/book_factory.rb +2 -2
- data/lib/mumuki/domain/factories/chapter_factory.rb +2 -2
- data/lib/mumuki/domain/factories/course_factory.rb +2 -0
- data/lib/mumuki/domain/factories/exam_factory.rb +2 -1
- data/lib/mumuki/domain/factories/guide_factory.rb +2 -2
- data/lib/mumuki/domain/factories/invitation_factory.rb +1 -1
- data/lib/mumuki/domain/factories/topic_factory.rb +2 -2
- data/lib/mumuki/domain/factories/user_factory.rb +1 -0
- data/lib/mumuki/domain/helpers/organization.rb +6 -1
- data/lib/mumuki/domain/helpers/user.rb +7 -7
- data/lib/mumuki/domain/locales/activerecord/en.yml +1 -0
- data/lib/mumuki/domain/locales/activerecord/es.yml +1 -0
- data/lib/mumuki/domain/locales/activerecord/pt.yml +1 -0
- data/lib/mumuki/domain/organization/settings.rb +12 -1
- data/lib/mumuki/domain/status/discussion/discussion.rb +4 -0
- data/lib/mumuki/domain/status/discussion/opened.rb +0 -8
- data/lib/mumuki/domain/submission/base.rb +6 -0
- data/lib/mumuki/domain/submission/solution.rb +3 -1
- data/lib/mumuki/domain/version.rb +1 -1
- data/lib/mumuki/domain/workspace.rb +38 -0
- metadata +24 -7
@@ -0,0 +1,38 @@
|
|
1
|
+
class Mumuki::Domain::Workspace
|
2
|
+
attr_accessor :user, :area
|
3
|
+
|
4
|
+
# area is a organization-like or course-like object
|
5
|
+
# that can be converted into slugs, has content and access-rules information
|
6
|
+
def initialize(user, area)
|
7
|
+
@user = user
|
8
|
+
@area = area
|
9
|
+
end
|
10
|
+
|
11
|
+
def annonymous?
|
12
|
+
user.nil?
|
13
|
+
end
|
14
|
+
|
15
|
+
def teacher?
|
16
|
+
user.teacher_of? area
|
17
|
+
end
|
18
|
+
|
19
|
+
# Takes a didactic sequence of containers and retuns the enabled containers
|
20
|
+
# for this user in this workspace.
|
21
|
+
#
|
22
|
+
# This method does not check the user is actually member of the area,
|
23
|
+
# you should check that before sending this message
|
24
|
+
#
|
25
|
+
def enabled_containers(sequence)
|
26
|
+
return sequence if annonymous? || teacher?
|
27
|
+
|
28
|
+
# TODO refactor when introducing access rules
|
29
|
+
if area.progressive_display_lookahead
|
30
|
+
user.completed_containers_with_lookahead(
|
31
|
+
sequence,
|
32
|
+
area.to_organization,
|
33
|
+
lookahead: area.progressive_display_lookahead)
|
34
|
+
else
|
35
|
+
sequence
|
36
|
+
end
|
37
|
+
end
|
38
|
+
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: 7.
|
4
|
+
version: 7.7.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: 2020-
|
11
|
+
date: 2020-07-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -58,14 +58,14 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '4.
|
61
|
+
version: '4.1'
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '4.
|
68
|
+
version: '4.1'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: mumukit-content-type
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -247,11 +247,14 @@ files:
|
|
247
247
|
- app/models/api_client.rb
|
248
248
|
- app/models/application_record.rb
|
249
249
|
- app/models/assignment.rb
|
250
|
+
- app/models/avatar.rb
|
250
251
|
- app/models/book.rb
|
251
252
|
- app/models/chapter.rb
|
252
253
|
- app/models/complement.rb
|
253
254
|
- app/models/concerns/assistable.rb
|
255
|
+
- app/models/concerns/container.rb
|
254
256
|
- app/models/concerns/contextualization.rb
|
257
|
+
- app/models/concerns/disabling.rb
|
255
258
|
- app/models/concerns/friendly_name.rb
|
256
259
|
- app/models/concerns/guide_container.rb
|
257
260
|
- app/models/concerns/navigation/parent_navigation.rb
|
@@ -266,7 +269,6 @@ files:
|
|
266
269
|
- app/models/concerns/topic_container.rb
|
267
270
|
- app/models/concerns/with_assignments.rb
|
268
271
|
- app/models/concerns/with_case_insensitive_search.rb
|
269
|
-
- app/models/concerns/with_content.rb
|
270
272
|
- app/models/concerns/with_description.rb
|
271
273
|
- app/models/concerns/with_discussion_creation.rb
|
272
274
|
- app/models/concerns/with_discussion_creation/subscription.rb
|
@@ -297,6 +299,7 @@ files:
|
|
297
299
|
- app/models/discussion.rb
|
298
300
|
- app/models/event.rb
|
299
301
|
- app/models/exam.rb
|
302
|
+
- app/models/exam/passing_criterion.rb
|
300
303
|
- app/models/exam_authorization.rb
|
301
304
|
- app/models/exercise.rb
|
302
305
|
- app/models/exercise/challenge.rb
|
@@ -599,17 +602,31 @@ files:
|
|
599
602
|
- db/migrate/20200127142401_add_private_to_topics_and_books.rb
|
600
603
|
- db/migrate/20200213175736_add_verified_names_to_users.rb
|
601
604
|
- db/migrate/20200312181842_add_results_hidden_for_choices_to_exam.rb
|
605
|
+
- db/migrate/20200508191543_create_avatars.rb
|
606
|
+
- db/migrate/20200518135658_add_avatar_to_users.rb
|
607
|
+
- db/migrate/20200527180729_add_disabled_at_to_users.rb
|
608
|
+
- db/migrate/20200601203033_add_course_to_exam.rb
|
609
|
+
- db/migrate/20200605161350_add_passing_criterions_to_exam.rb
|
610
|
+
- db/migrate/20200608132959_add_progressive_display_lookahead_to_organizations.rb
|
611
|
+
- db/migrate/20200702165503_add_messages_count_to_discussion.rb
|
612
|
+
- db/migrate/20200728162727_add_not_actually_a_question_field_to_messages.rb
|
613
|
+
- db/migrate/20200728163038_add_requires_moderator_response_to_discussions.rb
|
614
|
+
- db/migrate/20200731081757_add_last_moderator_access_fields_to_discussion.rb
|
602
615
|
- lib/mumuki/domain.rb
|
616
|
+
- lib/mumuki/domain/area.rb
|
603
617
|
- lib/mumuki/domain/engine.rb
|
604
618
|
- lib/mumuki/domain/evaluation.rb
|
605
619
|
- lib/mumuki/domain/evaluation/automated.rb
|
606
620
|
- lib/mumuki/domain/evaluation/manual.rb
|
607
621
|
- lib/mumuki/domain/exceptions.rb
|
608
622
|
- lib/mumuki/domain/exceptions/blocked_forum_error.rb
|
623
|
+
- lib/mumuki/domain/exceptions/disabled_error.rb
|
624
|
+
- lib/mumuki/domain/exceptions/disabled_organization_error.rb
|
609
625
|
- lib/mumuki/domain/exceptions/forbidden_error.rb
|
610
626
|
- lib/mumuki/domain/exceptions/gone_error.rb
|
611
627
|
- lib/mumuki/domain/exceptions/not_found_error.rb
|
612
628
|
- lib/mumuki/domain/exceptions/unauthorized_error.rb
|
629
|
+
- lib/mumuki/domain/exceptions/unprepared_organization_error.rb
|
613
630
|
- lib/mumuki/domain/extensions.rb
|
614
631
|
- lib/mumuki/domain/extensions/array.rb
|
615
632
|
- lib/mumuki/domain/extensions/hash.rb
|
@@ -684,6 +701,7 @@ files:
|
|
684
701
|
- lib/mumuki/domain/syncable.rb
|
685
702
|
- lib/mumuki/domain/syncable/with_resource_fields.rb
|
686
703
|
- lib/mumuki/domain/version.rb
|
704
|
+
- lib/mumuki/domain/workspace.rb
|
687
705
|
homepage: https://mumuki.org
|
688
706
|
licenses:
|
689
707
|
- AGPL-3.0
|
@@ -703,8 +721,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
703
721
|
- !ruby/object:Gem::Version
|
704
722
|
version: '0'
|
705
723
|
requirements: []
|
706
|
-
|
707
|
-
rubygems_version: 2.7.7
|
724
|
+
rubygems_version: 3.0.8
|
708
725
|
signing_key:
|
709
726
|
specification_version: 4
|
710
727
|
summary: Mumuki Platform's Domain Model
|