mork 0.18.2 → 0.19.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 +4 -4
- data/README.md +1 -1
- data/lib/mork/magicko.rb +7 -0
- data/lib/mork/sheet_omr.rb +7 -4
- data/lib/mork/version.rb +1 -1
- data/spec/mork/magicko_spec.rb +8 -0
- data/spec/mork/sheet_omr_spec.rb +2 -0
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 8d1ff44d3b000b420e231a5ab3823293dad26ef69ec29ade174e74db32b16b9c
|
|
4
|
+
data.tar.gz: 520167a98213a49bec5820fb7d2476416197484dd93785ed861bb4998b9ca2ec
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6c66b3b59d316efe183f978e7702c03608ef08208a202640648a5e76d023d54d9bd6985db7d9307d677ca5c6f85776f1264fe141f9edcebb8ecf206956f4ca49
|
|
7
|
+
data.tar.gz: 580d00362722d80ea7af5411486174f714328de9ddf936a59aa911f86525725e27c5452aaa909ea2d2bc89abd57ee6b46e7e9434f239201c7ae12ea738f06bdf
|
data/README.md
CHANGED
|
@@ -315,7 +315,7 @@ system 'open corrections.jpg' # this works in macOS
|
|
|
315
315
|
|
|
316
316
|
`overlay_corrections` applies:
|
|
317
317
|
|
|
318
|
-
- a green outline on the marked cell when the response is correct
|
|
318
|
+
- a green outline and semitransparent green fill on the marked cell when the response is correct
|
|
319
319
|
- a red outline on the expected cell and a red cross on the marked cell when the response is incorrect
|
|
320
320
|
- a red outline on the expected cell when the response is blank or invalid
|
|
321
321
|
|
data/lib/mork/magicko.rb
CHANGED
|
@@ -81,6 +81,13 @@ module Mork
|
|
|
81
81
|
coords.each { |c| @cmd << [:draw, shape(c, rounded)] }
|
|
82
82
|
end
|
|
83
83
|
|
|
84
|
+
def highlight_green(coords, rounded)
|
|
85
|
+
return if coords.empty?
|
|
86
|
+
@cmd << [:stroke, 'none']
|
|
87
|
+
@cmd << [:fill, 'rgba(0, 255, 0, 0.3)']
|
|
88
|
+
coords.each { |c| @cmd << [:draw, shape(c, rounded)] }
|
|
89
|
+
end
|
|
90
|
+
|
|
84
91
|
def outline(coords, rounded)
|
|
85
92
|
outline_with_color(coords, rounded, 'green')
|
|
86
93
|
end
|
data/lib/mork/sheet_omr.rb
CHANGED
|
@@ -165,10 +165,10 @@ module Mork
|
|
|
165
165
|
|
|
166
166
|
# Applies correctness-aware overlays to the image using an answer key.
|
|
167
167
|
#
|
|
168
|
-
# Correct responses receive a green outline
|
|
169
|
-
#
|
|
170
|
-
# the given cell. Blank or invalid
|
|
171
|
-
# on the expected cell.
|
|
168
|
+
# Correct responses receive a green outline and semitransparent green fill
|
|
169
|
+
# on the marked cell. Incorrect responses receive a red outline on the
|
|
170
|
+
# expected cell and a red cross on the given cell. Blank or invalid
|
|
171
|
+
# responses receive only the red outline on the expected cell.
|
|
172
172
|
#
|
|
173
173
|
# @param correct_choices [Array<Integer, Array<Integer>, nil>] one entry per
|
|
174
174
|
# question. Each entry can be an integer choice index, a 1-element array
|
|
@@ -183,6 +183,7 @@ module Mork
|
|
|
183
183
|
actual = marked_responses(marked)
|
|
184
184
|
|
|
185
185
|
green_outlines = Array.new(expected.length) { [] }
|
|
186
|
+
green_highlights = Array.new(expected.length) { [] }
|
|
186
187
|
red_outlines = Array.new(expected.length) { [] }
|
|
187
188
|
red_crosses = Array.new(expected.length) { [] }
|
|
188
189
|
|
|
@@ -192,6 +193,7 @@ module Mork
|
|
|
192
193
|
marked_cells = actual[question]
|
|
193
194
|
if marked_cells == [choice]
|
|
194
195
|
green_outlines[question] = [choice]
|
|
196
|
+
green_highlights[question] = [choice]
|
|
195
197
|
next
|
|
196
198
|
end
|
|
197
199
|
|
|
@@ -200,6 +202,7 @@ module Mork
|
|
|
200
202
|
end
|
|
201
203
|
|
|
202
204
|
@mim.overlay :outline_green, green_outlines
|
|
205
|
+
@mim.overlay :highlight_green, green_highlights
|
|
203
206
|
@mim.overlay :outline_red, red_outlines
|
|
204
207
|
@mim.overlay :check_red, red_crosses
|
|
205
208
|
end
|
data/lib/mork/version.rb
CHANGED
data/spec/mork/magicko_spec.rb
CHANGED
|
@@ -73,6 +73,14 @@ module Mork
|
|
|
73
73
|
ma.outline [co], false
|
|
74
74
|
expect(ma.instance_variable_get(:@cmd)).to include([:strokewidth, 6])
|
|
75
75
|
end
|
|
76
|
+
|
|
77
|
+
it 'draws a semitransparent green fill over the cell' do
|
|
78
|
+
ma.highlight_green [co], false
|
|
79
|
+
commands = ma.instance_variable_get(:@cmd)
|
|
80
|
+
expect(commands).to include([:stroke, 'none'])
|
|
81
|
+
expect(commands).to include([:fill, 'rgba(0, 255, 0, 0.3)'])
|
|
82
|
+
expect(commands).to include([:draw, 'rectangle 0 0 50 50'])
|
|
83
|
+
end
|
|
76
84
|
end
|
|
77
85
|
end
|
|
78
86
|
end
|
data/spec/mork/sheet_omr_spec.rb
CHANGED
|
@@ -167,6 +167,7 @@ module Mork
|
|
|
167
167
|
allow(omr).to receive(:marked_choices).and_return([[1], [2], [], [3, 4]])
|
|
168
168
|
|
|
169
169
|
expect(mim).to receive(:overlay).with(:outline_green, [[1], [], [], []]).ordered
|
|
170
|
+
expect(mim).to receive(:overlay).with(:highlight_green, [[1], [], [], []]).ordered
|
|
170
171
|
expect(mim).to receive(:overlay).with(:outline_red, [[], [0], [2], [3]]).ordered
|
|
171
172
|
expect(mim).to receive(:overlay).with(:check_red, [[], [2], [], []]).ordered
|
|
172
173
|
|
|
@@ -179,6 +180,7 @@ module Mork
|
|
|
179
180
|
omr.set_choices [5] * 2
|
|
180
181
|
|
|
181
182
|
expect(mim).to receive(:overlay).with(:outline_green, [[], []]).ordered
|
|
183
|
+
expect(mim).to receive(:overlay).with(:highlight_green, [[], []]).ordered
|
|
182
184
|
expect(mim).to receive(:overlay).with(:outline_red, [[3], [1]]).ordered
|
|
183
185
|
expect(mim).to receive(:overlay).with(:check_red, [[1, 2], [0]]).ordered
|
|
184
186
|
|