mumuki-domain 6.3.0 → 6.4.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: f3af22410021f5f748fe3b4662ba1703fc03211261181377dc3b10fcbcca24d9
4
- data.tar.gz: 0e1b4ee077345dcfd7b22634f9f818ad5d70b24a923bb2a5d9617d27145c3ac2
3
+ metadata.gz: c4c4181f62ae031a743d024a6024ef4b8b8a201ff47c6473a2c743b6809eb759
4
+ data.tar.gz: 3b9e7473b639604ff8ebe91932d0076d8a5d6b0315276ee7a5e680a378e8a9ab
5
5
  SHA512:
6
- metadata.gz: 388263f0fc37694d2cb4c15e5e5e867258dc421f2175d9f41845d9eba97a76ac26586a38e4a24da3a778ce7032be0e1141963a7766b319b3108fd0200cf3a899
7
- data.tar.gz: 0ab961c7820e7c8ac9115b9a41340b0586122ce6a87fbc4f2be54cb5307f0947f7105f5563b6bbeb531fa41bae60ac59f5cc0fd790f603c7bb32f2802d5695ef
6
+ metadata.gz: f300e63478a7c547d55c51b3d5ac4814ce474d4ad9209bb9c31a03e7383d4d607d1770822ce086e40118b419845020297e5b996a4caaf0a5e2532cae9c48a124
7
+ data.tar.gz: eee17bfc4d2e8555379b8f5c387ce87144e4e6d5617e4cbfd6638d2dab26765e3a6d6aad973ae34c27e9f20b6cf5c9cd5fa57381711d89d45c9ee80f99356813
data/LICENSE CHANGED
@@ -1,23 +1,21 @@
1
- GNU GENERAL PUBLIC LICENSE
2
- Version 3, 29 June 2007
1
+ GNU AFFERO GENERAL PUBLIC LICENSE
2
+ Version 3, 19 November 2007
3
3
 
4
- Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
4
+ Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
5
5
  Everyone is permitted to copy and distribute verbatim copies
6
6
  of this license document, but changing it is not allowed.
7
7
 
8
8
  Preamble
9
9
 
10
- The GNU General Public License is a free, copyleft license for
11
- software and other kinds of works.
10
+ The GNU Affero General Public License is a free, copyleft license for
11
+ software and other kinds of works, specifically designed to ensure
12
+ cooperation with the community in the case of network server software.
12
13
 
13
14
  The licenses for most software and other practical works are designed
14
15
  to take away your freedom to share and change the works. By contrast,
15
- the GNU General Public License is intended to guarantee your freedom to
16
+ our General Public Licenses are intended to guarantee your freedom to
16
17
  share and change all versions of a program--to make sure it remains free
17
- software for all its users. We, the Free Software Foundation, use the
18
- GNU General Public License for most of our software; it applies also to
19
- any other work released this way by its authors. You can apply it to
20
- your programs, too.
18
+ software for all its users.
21
19
 
22
20
  When we speak of free software, we are referring to freedom, not
23
21
  price. Our General Public Licenses are designed to make sure that you
@@ -26,44 +24,34 @@ them if you wish), that you receive source code or can get it if you
26
24
  want it, that you can change the software or use pieces of it in new
27
25
  free programs, and that you know you can do these things.
28
26
 
29
- To protect your rights, we need to prevent others from denying you
30
- these rights or asking you to surrender the rights. Therefore, you have
31
- certain responsibilities if you distribute copies of the software, or if
32
- you modify it: responsibilities to respect the freedom of others.
33
-
34
- For example, if you distribute copies of such a program, whether
35
- gratis or for a fee, you must pass on to the recipients the same
36
- freedoms that you received. You must make sure that they, too, receive
37
- or can get the source code. And you must show them these terms so they
38
- know their rights.
39
-
40
- Developers that use the GNU GPL protect your rights with two steps:
41
- (1) assert copyright on the software, and (2) offer you this License
42
- giving you legal permission to copy, distribute and/or modify it.
43
-
44
- For the developers' and authors' protection, the GPL clearly explains
45
- that there is no warranty for this free software. For both users' and
46
- authors' sake, the GPL requires that modified versions be marked as
47
- changed, so that their problems will not be attributed erroneously to
48
- authors of previous versions.
49
-
50
- Some devices are designed to deny users access to install or run
51
- modified versions of the software inside them, although the manufacturer
52
- can do so. This is fundamentally incompatible with the aim of
53
- protecting users' freedom to change the software. The systematic
54
- pattern of such abuse occurs in the area of products for individuals to
55
- use, which is precisely where it is most unacceptable. Therefore, we
56
- have designed this version of the GPL to prohibit the practice for those
57
- products. If such problems arise substantially in other domains, we
58
- stand ready to extend this provision to those domains in future versions
59
- of the GPL, as needed to protect the freedom of users.
60
-
61
- Finally, every program is threatened constantly by software patents.
62
- States should not allow patents to restrict development and use of
63
- software on general-purpose computers, but in those that do, we wish to
64
- avoid the special danger that patents applied to a free program could
65
- make it effectively proprietary. To prevent this, the GPL assures that
66
- patents cannot be used to render the program non-free.
27
+ Developers that use our General Public Licenses protect your rights
28
+ with two steps: (1) assert copyright on the software, and (2) offer
29
+ you this License which gives you legal permission to copy, distribute
30
+ and/or modify the software.
31
+
32
+ A secondary benefit of defending all users' freedom is that
33
+ improvements made in alternate versions of the program, if they
34
+ receive widespread use, become available for other developers to
35
+ incorporate. Many developers of free software are heartened and
36
+ encouraged by the resulting cooperation. However, in the case of
37
+ software used on network servers, this result may fail to come about.
38
+ The GNU General Public License permits making a modified version and
39
+ letting the public access it on a server without ever releasing its
40
+ source code to the public.
41
+
42
+ The GNU Affero General Public License is designed specifically to
43
+ ensure that, in such cases, the modified source code becomes available
44
+ to the community. It requires the operator of a network server to
45
+ provide the source code of the modified version running there to the
46
+ users of that server. Therefore, public use of a modified version, on
47
+ a publicly accessible server, gives the public access to the source
48
+ code of the modified version.
49
+
50
+ An older license, called the Affero General Public License and
51
+ published by Affero, was designed to accomplish similar goals. This is
52
+ a different license, not a version of the Affero GPL, but Affero has
53
+ released a new version of the Affero GPL which permits relicensing under
54
+ this license.
67
55
 
68
56
  The precise terms and conditions for copying, distribution and
69
57
  modification follow.
@@ -72,7 +60,7 @@ modification follow.
72
60
 
73
61
  0. Definitions.
74
62
 
75
- "This License" refers to version 3 of the GNU General Public License.
63
+ "This License" refers to version 3 of the GNU Affero General Public License.
76
64
 
77
65
  "Copyright" also means copyright-like laws that apply to other kinds of
78
66
  works, such as semiconductor masks.
@@ -549,35 +537,45 @@ to collect a royalty for further conveying from those to whom you convey
549
537
  the Program, the only way you could satisfy both those terms and this
550
538
  License would be to refrain entirely from conveying the Program.
551
539
 
552
- 13. Use with the GNU Affero General Public License.
540
+ 13. Remote Network Interaction; Use with the GNU General Public License.
541
+
542
+ Notwithstanding any other provision of this License, if you modify the
543
+ Program, your modified version must prominently offer all users
544
+ interacting with it remotely through a computer network (if your version
545
+ supports such interaction) an opportunity to receive the Corresponding
546
+ Source of your version by providing access to the Corresponding Source
547
+ from a network server at no charge, through some standard or customary
548
+ means of facilitating copying of software. This Corresponding Source
549
+ shall include the Corresponding Source for any work covered by version 3
550
+ of the GNU General Public License that is incorporated pursuant to the
551
+ following paragraph.
553
552
 
554
553
  Notwithstanding any other provision of this License, you have
555
554
  permission to link or combine any covered work with a work licensed
556
- under version 3 of the GNU Affero General Public License into a single
555
+ under version 3 of the GNU General Public License into a single
557
556
  combined work, and to convey the resulting work. The terms of this
558
557
  License will continue to apply to the part which is the covered work,
559
- but the special requirements of the GNU Affero General Public License,
560
- section 13, concerning interaction through a network will apply to the
561
- combination as such.
558
+ but the work with which it is combined will remain governed by version
559
+ 3 of the GNU General Public License.
562
560
 
563
561
  14. Revised Versions of this License.
564
562
 
565
563
  The Free Software Foundation may publish revised and/or new versions of
566
- the GNU General Public License from time to time. Such new versions will
567
- be similar in spirit to the present version, but may differ in detail to
564
+ the GNU Affero General Public License from time to time. Such new versions
565
+ will be similar in spirit to the present version, but may differ in detail to
568
566
  address new problems or concerns.
569
567
 
570
568
  Each version is given a distinguishing version number. If the
571
- Program specifies that a certain numbered version of the GNU General
569
+ Program specifies that a certain numbered version of the GNU Affero General
572
570
  Public License "or any later version" applies to it, you have the
573
571
  option of following the terms and conditions either of that numbered
574
572
  version or of any later version published by the Free Software
575
573
  Foundation. If the Program does not specify a version number of the
576
- GNU General Public License, you may choose any version ever published
574
+ GNU Affero General Public License, you may choose any version ever published
577
575
  by the Free Software Foundation.
578
576
 
579
577
  If the Program specifies that a proxy can decide which future
580
- versions of the GNU General Public License can be used, that proxy's
578
+ versions of the GNU Affero General Public License can be used, that proxy's
581
579
  public statement of acceptance of a version permanently authorizes you
582
580
  to choose that version for the Program.
583
581
 
@@ -631,44 +629,33 @@ to attach them to the start of each source file to most effectively
631
629
  state the exclusion of warranty; and each file should have at least
632
630
  the "copyright" line and a pointer to where the full notice is found.
633
631
 
634
- {one line to give the program's name and a brief idea of what it does.}
635
- Copyright (C) {year} {name of author}
632
+ <one line to give the program's name and a brief idea of what it does.>
633
+ Copyright (C) <year> <name of author>
636
634
 
637
635
  This program is free software: you can redistribute it and/or modify
638
- it under the terms of the GNU General Public License as published by
639
- the Free Software Foundation, either version 3 of the License, or
636
+ it under the terms of the GNU Affero General Public License as published
637
+ by the Free Software Foundation, either version 3 of the License, or
640
638
  (at your option) any later version.
641
639
 
642
640
  This program is distributed in the hope that it will be useful,
643
641
  but WITHOUT ANY WARRANTY; without even the implied warranty of
644
642
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645
- GNU General Public License for more details.
643
+ GNU Affero General Public License for more details.
646
644
 
647
- You should have received a copy of the GNU General Public License
648
- along with this program. If not, see <http://www.gnu.org/licenses/>.
645
+ You should have received a copy of the GNU Affero General Public License
646
+ along with this program. If not, see <https://www.gnu.org/licenses/>.
649
647
 
650
648
  Also add information on how to contact you by electronic and paper mail.
651
649
 
652
- If the program does terminal interaction, make it output a short
653
- notice like this when it starts in an interactive mode:
654
-
655
- {project} Copyright (C) {year} {fullname}
656
- This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657
- This is free software, and you are welcome to redistribute it
658
- under certain conditions; type `show c' for details.
659
-
660
- The hypothetical commands `show w' and `show c' should show the appropriate
661
- parts of the General Public License. Of course, your program's commands
662
- might be different; for a GUI interface, you would use an "about box".
650
+ If your software can interact with users remotely through a computer
651
+ network, you should also make sure that it provides a way for users to
652
+ get its source. For example, if your program is a web application, its
653
+ interface could display a "Source" link that leads users to an archive
654
+ of the code. There are many ways you could offer source, and different
655
+ solutions will be better for different programs; see section 13 for the
656
+ specific requirements.
663
657
 
664
658
  You should also get your employer (if you work as a programmer) or school,
665
659
  if any, to sign a "copyright disclaimer" for the program, if necessary.
666
- For more information on this, and how to apply and follow the GNU GPL, see
667
- <http://www.gnu.org/licenses/>.
668
-
669
- The GNU General Public License does not permit incorporating your program
670
- into proprietary programs. If your program is a subroutine library, you
671
- may consider it more useful to permit linking proprietary applications with
672
- the library. If this is what you want to do, use the GNU Lesser General
673
- Public License instead of this License. But first, please read
674
- <http://www.gnu.org/philosophy/why-not-lgpl.html>.
660
+ For more information on this, and how to apply and follow the GNU AGPL, see
661
+ <https://www.gnu.org/licenses/>.
data/README.md CHANGED
@@ -130,6 +130,8 @@ _as defined in `Topic#to_resource_h`_
130
130
  private
131
131
  expectations
132
132
  collaborators
133
+ sources
134
+ learn_more
133
135
  description
134
136
  corollary
135
137
  locale
@@ -1,4 +1,6 @@
1
1
  class Exercise < ApplicationRecord
2
+ RANDOMIZED_FIELDS = [:default_content, :description, :extra, :hint, :test]
3
+
2
4
  include WithDescription
3
5
  include WithLocale
4
6
  include WithNumber,
@@ -8,8 +10,7 @@ class Exercise < ApplicationRecord
8
10
  WithLanguage,
9
11
  Assistable,
10
12
  WithRandomizations,
11
- WithDiscussions,
12
- WithEditionMode
13
+ WithDiscussions
13
14
 
14
15
  include Submittable,
15
16
  Questionable
@@ -24,11 +25,9 @@ class Exercise < ApplicationRecord
24
25
  validates_presence_of :submissions_count,
25
26
  :guide, :bibliotheca_id
26
27
 
27
- randomize :description, :hint, :extra, :test, :default_content
28
+ randomize(*RANDOMIZED_FIELDS)
28
29
  delegate :timed?, to: :navigable_parent
29
30
 
30
- editable :description, :hint, :test, :default_content
31
-
32
31
  def console?
33
32
  queriable?
34
33
  end
@@ -109,10 +108,12 @@ class Exercise < ApplicationRecord
109
108
 
110
109
  def to_resource_h
111
110
  language_resource_h = language.to_embedded_resource_h if language != guide.language
112
- as_json(only: %i(name layout editor description corollary teacher_info hint test manual_evaluation locale extra
113
- choices expectations assistance_rules randomizations tag_list extra_visible goal default_content
111
+ as_json(only: %i(name layout editor corollary teacher_info manual_evaluation locale
112
+ choices assistance_rules randomizations tag_list extra_visible goal
114
113
  free_form_editor_source initial_state final_state))
115
114
  .merge(id: bibliotheca_id, language: language_resource_h, type: type.underscore)
115
+ .merge(expectations: self[:expectations])
116
+ .merge(RANDOMIZED_FIELDS.map { |it| [it, self[it]] }.to_h)
116
117
  .symbolize_keys
117
118
  .compact
118
119
  end
@@ -167,10 +168,6 @@ class Exercise < ApplicationRecord
167
168
  {}
168
169
  end
169
170
 
170
- def default_content
171
- self[:default_content] || ''
172
- end
173
-
174
171
  # Submits the user solution
175
172
  # only if the corresponding assignment has attemps left
176
173
  def try_submit_solution!(user, solution={})
@@ -16,8 +16,6 @@ class Challenge < Exercise
16
16
  .ensure_newline
17
17
  end
18
18
 
19
- editable :extra
20
-
21
19
  private
22
20
 
23
21
  def defaults
@@ -25,8 +25,6 @@ class Problem < QueriableChallenge
25
25
  own_expectations + guide_expectations
26
26
  end
27
27
 
28
- editable :expectations
29
-
30
28
  def guide_expectations
31
29
  guide.expectations
32
30
  end
@@ -3,7 +3,7 @@ class Guide < Content
3
3
  WithExpectations,
4
4
  WithLanguage
5
5
 
6
- markdown_on :corollary
6
+ markdown_on :corollary, :sources, :learn_more
7
7
 
8
8
  numbered :exercises
9
9
  has_many :exercises, -> { order(number: :asc) }, dependent: :delete_all
@@ -80,7 +80,7 @@ class Guide < Content
80
80
  end
81
81
 
82
82
  def to_resource_h
83
- as_json(only: %i(beta type id_format private expectations corollary teacher_info authors collaborators extra))
83
+ as_json(only: %i(beta type id_format private expectations corollary teacher_info sources learn_more authors collaborators extra))
84
84
  .symbolize_keys
85
85
  .merge(super)
86
86
  .merge(exercises: exercises.map(&:to_resource_h))
@@ -75,6 +75,7 @@ class Language < ApplicationRecord
75
75
 
76
76
  # TODO we should use Mumukit::Directives::Pipeline
77
77
  def interpolate(interpolee, *interpolations)
78
+ interpolee = interpolee || ''
78
79
  interpolations.inject(interpolee) { |content, interpolation| directives_interpolations.interpolate(content, interpolation).first }
79
80
  end
80
81
 
@@ -129,5 +129,16 @@ class Organization < ApplicationRecord
129
129
  def sync_key_id_field
130
130
  :name
131
131
  end
132
+
133
+ # Answers organizations that have the given item
134
+ # in their paths.
135
+ #
136
+ # See `Organization#in_path?`
137
+ def in_path(item)
138
+ joins(:usages)
139
+ .select('organizations.*, usages.item_id')
140
+ .where('usages.item_id = ?', item.id)
141
+ .distinct()
142
+ end
132
143
  end
133
144
  end
@@ -0,0 +1,5 @@
1
+ class AddSourcesSection < ActiveRecord::Migration[5.1]
2
+ def change
3
+ add_column :guides, :sources, :text
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ class AddLearnMoreSection < ActiveRecord::Migration[5.1]
2
+ def change
3
+ add_column :guides, :learn_more, :text
4
+ end
5
+ end
@@ -15,3 +15,4 @@ require_relative './factories/message_factory'
15
15
  require_relative './factories/organization_factory'
16
16
  require_relative './factories/topic_factory'
17
17
  require_relative './factories/user_factory'
18
+ require_relative './factories/usage_factory'
@@ -0,0 +1,6 @@
1
+ FactoryBot.define do
2
+ factory :usage do
3
+ item { create(:topic) }
4
+ parent_item { create(:chapter) }
5
+ end
6
+ end
@@ -1,5 +1,5 @@
1
1
  module Mumuki
2
2
  module Domain
3
- VERSION = '6.3.0'
3
+ VERSION = '6.4.0'
4
4
  end
5
5
  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: 6.3.0
4
+ version: 6.4.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: 2018-12-21 00:00:00.000000000 Z
11
+ date: 2019-01-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -230,7 +230,6 @@ files:
230
230
  - app/models/concerns/with_discussion_creation/upvote.rb
231
231
  - app/models/concerns/with_discussion_status.rb
232
232
  - app/models/concerns/with_discussions.rb
233
- - app/models/concerns/with_edition_mode.rb
234
233
  - app/models/concerns/with_editor.rb
235
234
  - app/models/concerns/with_expectations.rb
236
235
  - app/models/concerns/with_language.rb
@@ -533,6 +532,8 @@ files:
533
532
  - db/migrate/20181117190241_add_feedback_to_language.rb
534
533
  - db/migrate/20181121165956_rename_choices_column.rb
535
534
  - db/migrate/20181210131824_convert_course_invitation_into_fk.rb
535
+ - db/migrate/20190123180139_add_sources_section.rb
536
+ - db/migrate/20190123180147_add_learn_more_section.rb
536
537
  - lib/mumuki/domain.rb
537
538
  - lib/mumuki/domain/engine.rb
538
539
  - lib/mumuki/domain/evaluation.rb
@@ -564,6 +565,7 @@ files:
564
565
  - lib/mumuki/domain/factories/message_factory.rb
565
566
  - lib/mumuki/domain/factories/organization_factory.rb
566
567
  - lib/mumuki/domain/factories/topic_factory.rb
568
+ - lib/mumuki/domain/factories/usage_factory.rb
567
569
  - lib/mumuki/domain/factories/user_factory.rb
568
570
  - lib/mumuki/domain/file.rb
569
571
  - lib/mumuki/domain/locales/activerecord.en.yml
@@ -602,7 +604,7 @@ files:
602
604
  - lib/mumuki/domain/version.rb
603
605
  homepage: https://mumuki.org
604
606
  licenses:
605
- - GPL-3.0
607
+ - AGPL-3.0
606
608
  metadata: {}
607
609
  post_install_message:
608
610
  rdoc_options: []
@@ -619,7 +621,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
619
621
  - !ruby/object:Gem::Version
620
622
  version: '0'
621
623
  requirements: []
622
- rubygems_version: 3.0.0
624
+ rubygems_version: 3.0.2
623
625
  signing_key:
624
626
  specification_version: 4
625
627
  summary: Mumuki Platform's Domain Model
@@ -1,23 +0,0 @@
1
- module WithEditionMode
2
- extend ActiveSupport::Concern
3
-
4
- attr_accessor :edition_mode
5
-
6
- def edit!
7
- self.edition_mode = true
8
- end
9
-
10
- module ClassMethods
11
- def editable(*selectors)
12
- selectors.each { |selector| editable_field selector }
13
- end
14
-
15
- private
16
-
17
- def editable_field(selector)
18
- patch selector do |*args, hyper|
19
- edition_mode ? self[selector] : hyper.(*args)
20
- end
21
- end
22
- end
23
- end