canvas_shim 0.1.12 → 0.1.13

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: f650ecb3ec7e2e2d490c89e80f54bf7eb2e4db6a
4
- data.tar.gz: 690da5e52ca95469828742619272f4ebb8a638ec
2
+ SHA256:
3
+ metadata.gz: 222a2bb2d1c9136e4313b030fecd1d344e335fbf5baab7809a75f37936cb39bc
4
+ data.tar.gz: d03493b2051f6c275215fa149ecb0fa53120158ec53c99e23f7eb57f8830ca84
5
5
  SHA512:
6
- metadata.gz: 1d14eeb34afaffb9478014dd366bf167f59cb0f0bc7f59136c8bd4c3d47904461463f49afada4d3a235d987af415dca6e2c406bf3ba09fb7a9d323dd3324447b
7
- data.tar.gz: c14452cccdd268b10afe5518c6f46bd5e2544c55cd3d31b6c7916d8e6383490ca056cacb5bb7df37eaf98c7e2c8e4cde89149bc755bdd53d9ab800692f644670
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
@@ -1,3 +1,3 @@
1
1
  module CanvasShim
2
- VERSION = '0.1.12'
2
+ VERSION = '0.1.13'
3
3
  end
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.12
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-21 00:00:00.000000000 Z
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.6.14
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