zdubzdab_hola 0.1.3 → 0.1.4

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
2
  SHA1:
3
- metadata.gz: bd8ebddaeeb85210187066e3b7e0d84747f09b98
4
- data.tar.gz: 898a092c48b66a028c723ed6d754c4e8d4081f34
3
+ metadata.gz: 702dca3a3b04c6c4a689188cb8b5b1a555f31a28
4
+ data.tar.gz: 65bc03bec2c4ba3979162aa8a963f42c7c9525b7
5
5
  SHA512:
6
- metadata.gz: 7ae9a54be7863ed2b058881740d4c31f4617304c004dc0bcee05001b2dba51f9e078fb5cdbb997cb9b989b3b514ee91748bb12140d3c9331153f59e960ecb068
7
- data.tar.gz: 7ce3e26eac1617642c78c0e51c2f44c7f35ebb5070d84c6f1166d1d07964324b65f42d55d868360ad626d58a1e789513e0d4f54e7b9c81421a251b26bad9df9c
6
+ metadata.gz: b9f390f9aa8d1b4cf34d75d5940a8f407d8424eb5b5013aa525c9a89daa531a186c5069b92ca6f72e6cdd6c240137212db7527d67344bf357c6631a5ac363969
7
+ data.tar.gz: 49eb324e1b59af9b3b4d46ba493250a8c4fbe224c606b19de01af23f4045963a32d79c2fe31d4cd20b95c1a9f20fcbf5b5ad95a4f56095e0d426ded07baacf4a
@@ -10,9 +10,11 @@ module ZdubzdabHola
10
10
 
11
11
  module LocalInstanceMethods
12
12
  def count_result
13
- true_answers = Answer.belongs_to_current_test(self.id).with_true.joins(:answer_setting).where( answer_settings: {rigth: 'true'} )
13
+ true_answers = Answer.belongs_to_current_test(self.id)
14
+ .with_true.joins(:answer_setting)
15
+ .where( answer_settings: {rigth: 'true'} )
14
16
  all_questions = self.test_setting.questions
15
- result = Float(true_answers.count) / all_questions.count * 100
17
+ result = Float(true_answers.count) / (all_questions.count.nonzero? || 1) * 100
16
18
  self.update_attributes(complete_pers: result)
17
19
  end
18
20
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zdubzdab_hola
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - zdubzdab
@@ -10,7 +10,8 @@ bindir: bin
10
10
  cert_chain: []
11
11
  date: 2016-01-29 00:00:00.000000000 Z
12
12
  dependencies: []
13
- description: The simplest gem that calculate test result in percent.
13
+ description: The simplest gem that calculate test result in percent. Add 'include
14
+ ZdubzdabHola::CountResult::LocalInstanceMethods' to test model
14
15
  email: zdubzdab@gmail.com
15
16
  executables: []
16
17
  extensions: []