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 +4 -4
- data/lib/zdubzdab_hola/count_result.rb +4 -2
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 702dca3a3b04c6c4a689188cb8b5b1a555f31a28
|
|
4
|
+
data.tar.gz: 65bc03bec2c4ba3979162aa8a963f42c7c9525b7
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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)
|
|
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.
|
|
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: []
|