proformaxml 1.5.0 → 1.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +23 -21
- data/lib/proformaxml/services/transform_task.rb +47 -13
- data/lib/proformaxml/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d18194bbaa507eb74a566d374f500824deb6d40380291f0a691d9d98d5050466
|
4
|
+
data.tar.gz: 9903f5f2beae7909cb1e02f7e351f41d8c60fc3135a6ad8ea447441d07f696d0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 828392048a14868c751d143d338416a08b283f85d3d16665a3267ea466ec701589851ca711deef2880064c966a6cbb9cbded366c4fddea4da470695f063ce631
|
7
|
+
data.tar.gz: b7b22d6e668c3bbfbba4a8280991c3800b4b340260dfc8096f3c96d1e755e888647c30c0b2f0f0b6d0736284b7716bbc9227be071fbfb7ec81a971151add6504
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
proformaxml (1.5.
|
4
|
+
proformaxml (1.5.1)
|
5
5
|
activemodel (>= 5.2.3, < 8.0.0)
|
6
6
|
activesupport (>= 5.2.3, < 8.0.0)
|
7
7
|
dachsfisch (~> 1.0.0)
|
@@ -11,24 +11,25 @@ PATH
|
|
11
11
|
GEM
|
12
12
|
remote: https://rubygems.org/
|
13
13
|
specs:
|
14
|
-
activemodel (7.1
|
15
|
-
activesupport (= 7.1
|
16
|
-
activesupport (7.1
|
14
|
+
activemodel (7.2.1)
|
15
|
+
activesupport (= 7.2.1)
|
16
|
+
activesupport (7.2.1)
|
17
17
|
base64
|
18
18
|
bigdecimal
|
19
|
-
concurrent-ruby (~> 1.0, >= 1.
|
19
|
+
concurrent-ruby (~> 1.0, >= 1.3.1)
|
20
20
|
connection_pool (>= 2.2.5)
|
21
21
|
drb
|
22
22
|
i18n (>= 1.6, < 2)
|
23
|
+
logger (>= 1.4.2)
|
23
24
|
minitest (>= 5.1)
|
24
|
-
|
25
|
-
tzinfo (~> 2.0)
|
25
|
+
securerandom (>= 0.3)
|
26
|
+
tzinfo (~> 2.0, >= 2.0.5)
|
26
27
|
ast (2.4.2)
|
27
28
|
base64 (0.2.0)
|
28
29
|
bigdecimal (3.1.8)
|
29
30
|
byebug (11.1.3)
|
30
31
|
coderay (1.1.3)
|
31
|
-
concurrent-ruby (1.3.
|
32
|
+
concurrent-ruby (1.3.4)
|
32
33
|
connection_pool (2.4.1)
|
33
34
|
dachsfisch (1.0.0)
|
34
35
|
nokogiri (>= 1.14.1, < 2.0.0)
|
@@ -60,20 +61,20 @@ GEM
|
|
60
61
|
listen (3.9.0)
|
61
62
|
rb-fsevent (~> 0.10, >= 0.10.3)
|
62
63
|
rb-inotify (~> 0.9, >= 0.9.10)
|
64
|
+
logger (1.6.0)
|
63
65
|
lumberjack (1.2.10)
|
64
66
|
method_source (1.1.0)
|
65
67
|
mini_portile2 (2.8.7)
|
66
|
-
minitest (5.
|
67
|
-
mutex_m (0.2.0)
|
68
|
+
minitest (5.25.1)
|
68
69
|
nenv (0.3.0)
|
69
|
-
nokogiri (1.16.
|
70
|
+
nokogiri (1.16.7)
|
70
71
|
mini_portile2 (~> 2.8.2)
|
71
72
|
racc (~> 1.4)
|
72
73
|
notiffany (0.1.3)
|
73
74
|
nenv (~> 0.1)
|
74
75
|
shellany (~> 0.0)
|
75
|
-
parallel (1.
|
76
|
-
parser (3.3.4.
|
76
|
+
parallel (1.26.3)
|
77
|
+
parser (3.3.4.2)
|
77
78
|
ast (~> 2.4.1)
|
78
79
|
racc
|
79
80
|
pry (0.14.2)
|
@@ -82,15 +83,15 @@ GEM
|
|
82
83
|
pry-byebug (3.10.1)
|
83
84
|
byebug (~> 11.0)
|
84
85
|
pry (>= 0.13, < 0.15)
|
85
|
-
racc (1.8.
|
86
|
-
rack (3.1.
|
86
|
+
racc (1.8.1)
|
87
|
+
rack (3.1.7)
|
87
88
|
rainbow (3.1.1)
|
88
89
|
rake (13.2.1)
|
89
90
|
rb-fsevent (0.11.2)
|
90
91
|
rb-inotify (0.11.1)
|
91
92
|
ffi (~> 1.0)
|
92
93
|
regexp_parser (2.9.2)
|
93
|
-
rexml (3.3.
|
94
|
+
rexml (3.3.6)
|
94
95
|
strscan
|
95
96
|
rspec (3.13.0)
|
96
97
|
rspec-core (~> 3.13.0)
|
@@ -109,7 +110,7 @@ GEM
|
|
109
110
|
diff-lcs (>= 1.2.0, < 2.0)
|
110
111
|
rspec-support (~> 3.13.0)
|
111
112
|
rspec-support (3.13.1)
|
112
|
-
rubocop (1.65.
|
113
|
+
rubocop (1.65.1)
|
113
114
|
json (~> 2.3)
|
114
115
|
language_server-protocol (>= 3.17.0)
|
115
116
|
parallel (~> 1.10)
|
@@ -120,25 +121,26 @@ GEM
|
|
120
121
|
rubocop-ast (>= 1.31.1, < 2.0)
|
121
122
|
ruby-progressbar (~> 1.7)
|
122
123
|
unicode-display_width (>= 2.4.0, < 3.0)
|
123
|
-
rubocop-ast (1.
|
124
|
+
rubocop-ast (1.32.1)
|
124
125
|
parser (>= 3.3.1.0)
|
125
126
|
rubocop-factory_bot (2.26.1)
|
126
127
|
rubocop (~> 1.61)
|
127
128
|
rubocop-performance (1.21.1)
|
128
129
|
rubocop (>= 1.48.1, < 2.0)
|
129
130
|
rubocop-ast (>= 1.31.1, < 2.0)
|
130
|
-
rubocop-rails (2.
|
131
|
+
rubocop-rails (2.26.0)
|
131
132
|
activesupport (>= 4.2.0)
|
132
133
|
rack (>= 1.1)
|
133
|
-
rubocop (>= 1.
|
134
|
+
rubocop (>= 1.52.0, < 2.0)
|
134
135
|
rubocop-ast (>= 1.31.1, < 2.0)
|
135
|
-
rubocop-rspec (3.0.
|
136
|
+
rubocop-rspec (3.0.4)
|
136
137
|
rubocop (~> 1.61)
|
137
138
|
rubocop-rspec_rails (2.30.0)
|
138
139
|
rubocop (~> 1.61)
|
139
140
|
rubocop-rspec (~> 3, >= 3.0.1)
|
140
141
|
ruby-progressbar (1.13.0)
|
141
142
|
rubyzip (2.3.2)
|
143
|
+
securerandom (0.3.1)
|
142
144
|
shellany (0.0.1)
|
143
145
|
simplecov (0.22.0)
|
144
146
|
docile (~> 1.1)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require '
|
3
|
+
require 'active_support/core_ext/array/wrap'
|
4
4
|
|
5
5
|
module ProformaXML
|
6
6
|
class TransformTask < ServiceBase
|
@@ -23,26 +23,60 @@ module ProformaXML
|
|
23
23
|
private
|
24
24
|
|
25
25
|
def transform_from_2_0_to_2_1
|
26
|
-
|
27
|
-
|
28
|
-
fr['@use'] = fr.delete('@required') == 'true' ? 'required' : 'optional'
|
29
|
-
end
|
30
|
-
end
|
26
|
+
transform_submission_restrictions_from_2_0_to_2_1 unless @task.submission_restrictions.nil?
|
27
|
+
transform_external_resources_from_2_0_to_2_1 unless @task.external_resources.nil?
|
31
28
|
|
32
29
|
@task.model_solutions.filter! {|model_solution| model_solution.id != 'ms-placeholder' }
|
33
30
|
end
|
34
31
|
|
35
|
-
def
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
32
|
+
def transform_external_resources_from_2_0_to_2_1
|
33
|
+
ensure_array(@task.external_resources['external-resources']['external-resource']).each do |external_resource|
|
34
|
+
external_resource['@used-by-grader'] = external_resource['@used-by-grader'] || 'false'
|
35
|
+
external_resource['@visible'] = external_resource['@visible'] || 'no'
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def transform_submission_restrictions_from_2_0_to_2_1
|
40
|
+
ensure_array(@task.submission_restrictions['submission-restrictions']['file-restriction']).each do |fr|
|
41
|
+
fr['@use'] = if fr['@required'].nil? || fr.delete('@required') == 'true'
|
42
|
+
'required'
|
43
|
+
else
|
44
|
+
'optional'
|
45
|
+
end
|
42
46
|
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def transform_from_2_1_to_2_0
|
50
|
+
transform_submission_restrictions_from_2_1_to_2_0 unless @task.submission_restrictions.nil?
|
51
|
+
transform_external_resources_from_2_1_to_2_0 unless @task.external_resources.nil?
|
43
52
|
add_model_solution_placeholder
|
44
53
|
end
|
45
54
|
|
55
|
+
def transform_external_resources_from_2_1_to_2_0
|
56
|
+
ensure_array(@task.external_resources['external-resources']['external-resource']).each do |external_resource|
|
57
|
+
external_resource.delete('@visible')
|
58
|
+
external_resource.delete('@usage-by-lms')
|
59
|
+
external_resource.delete('@used-by-grader')
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
def transform_submission_restrictions_from_2_1_to_2_0
|
64
|
+
transform_file_restrictions_from_2_1_to_2_0
|
65
|
+
@task.submission_restrictions['submission-restrictions'].delete('description')
|
66
|
+
@task.submission_restrictions['submission-restrictions'].delete('internal-description')
|
67
|
+
end
|
68
|
+
|
69
|
+
def transform_file_restrictions_from_2_1_to_2_0
|
70
|
+
ensure_array(@task.submission_restrictions['submission-restrictions']['file-restriction']).each do |file_restriction|
|
71
|
+
file_restriction['@required'] = (file_restriction['@use'].nil? || file_restriction.delete('@use') == 'required').to_s
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
# when only one field is present, dachsfisch does not create an array. This method ensure, that we can work with an array
|
76
|
+
def ensure_array(data)
|
77
|
+
Array.wrap(data)
|
78
|
+
end
|
79
|
+
|
46
80
|
def add_model_solution_placeholder
|
47
81
|
return if @task.model_solutions&.any?
|
48
82
|
|
data/lib/proformaxml/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: proformaxml
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.5.
|
4
|
+
version: 1.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Karol
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-08-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|