canvas_shim 0.1.12 → 0.1.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/lib/basic_lti/basic_outcomes.rb +33 -0
- data/lib/canvas_shim/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 222a2bb2d1c9136e4313b030fecd1d344e335fbf5baab7809a75f37936cb39bc
|
4
|
+
data.tar.gz: d03493b2051f6c275215fa149ecb0fa53120158ec53c99e23f7eb57f8830ca84
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '06921403075932c26e4d03308cc562fa7b9655a30bd69d8179877f693f5065c9969b5fa9cd66a3ca266357bc143eed9ab55538a26483249692b9bc433514052f'
|
7
|
+
data.tar.gz: 264838ce40a6218cc03a08a4e897a3b2ceb15fc7433e1cdb1f4c3a9d9568658d7e698177256c171f74a410c7690fb10ece5f5b16c46fac228afc92c0e5f46758
|
@@ -0,0 +1,33 @@
|
|
1
|
+
module BasicLTI
|
2
|
+
module BasicOutcomes
|
3
|
+
class LtiResponse
|
4
|
+
alias_method :homework_submission_alias, :create_homework_submission
|
5
|
+
|
6
|
+
def create_homework_submission(_tool, submission_hash, assignment, user, new_score, raw_score)
|
7
|
+
homework_submission_alias(_tool, submission_hash, assignment, user, new_score, raw_score)
|
8
|
+
|
9
|
+
if SettingsService.get_settings(object: :school, id: 1)['lti_keep_highest_score']
|
10
|
+
update_submission_with_best_score
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
private
|
15
|
+
|
16
|
+
def update_submission_with_best_score
|
17
|
+
return unless @submission
|
18
|
+
best_score = @submission.score
|
19
|
+
best_grade = @submission.grade
|
20
|
+
versions = @submission.versions
|
21
|
+
versions.each do |version|
|
22
|
+
version_score = YAML.load(version.yaml).stringify_keys['score']
|
23
|
+
if version_score > best_score
|
24
|
+
best_score = version_score
|
25
|
+
best_grade = YAML.load(version.yaml).stringify_keys['grade']
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
@submission.update(score: best_score, grade: best_grade)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
data/lib/canvas_shim/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: canvas_shim
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ''
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-11-
|
11
|
+
date: 2018-11-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: grape
|
@@ -207,6 +207,7 @@ files:
|
|
207
207
|
- config/initializers/hash.rb
|
208
208
|
- config/initializers/string.rb
|
209
209
|
- config/routes.rb
|
210
|
+
- lib/basic_lti/basic_outcomes.rb
|
210
211
|
- lib/canvas_shim.rb
|
211
212
|
- lib/canvas_shim/engine.rb
|
212
213
|
- lib/canvas_shim/version.rb
|
@@ -231,7 +232,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
231
232
|
version: '0'
|
232
233
|
requirements: []
|
233
234
|
rubyforge_project:
|
234
|
-
rubygems_version: 2.
|
235
|
+
rubygems_version: 2.7.7
|
235
236
|
signing_key:
|
236
237
|
specification_version: 4
|
237
238
|
summary: A tool to make it easy to write code that plugs into canvas
|