osfans
Forum Replies Created
-
Forum: Plugins
In reply to: [Psychological tests & quizzes] minimum score errorIt works!
So you test scale max and length instead of min.Thanks!
Forum: Plugins
In reply to: [Psychological tests & quizzes] minimum score errorIt seems that I have to create a TestTest.php instead of adding a testcase in ScaleTest.php.
A big project! I’m not sure I can manage it.
Forum: Plugins
In reply to: [Psychological tests & quizzes] minimum score errorSo I will do as follows:
1. start a new feature from develop
2. try to fix and test.
3. finish the new feature and merge into develop
4. create PRIs it the right workflow of merging a new feature?
Forum: Plugins
In reply to: [Psychological tests & quizzes] minimum score errorI’ve never use ‘git flow’, and never wonder git could works in such a nice way. I’ll have a try.
Too many things(php, phpunit & git flow) to study.Thanks!
Forum: Plugins
In reply to: [Psychological tests & quizzes] minimum score errorFinally, it works after I install wordpress and wp-testing locally.
And set database in db/ruckusing.conf.php.
Is it OK?kyle@~/prj/wp/wp-testing % vendor/bin/phpunit-php52
PHPUnit @package_version@ by Sebastian Bergmann.Configuration read from /home/kyle/prj/wp/wp-testing/phpunit.xml.dist
……………………………………….
Time: 0 seconds, Memory: 7.75Mb
OK (46 tests, 65 assertions)
Forum: Plugins
In reply to: [Psychological tests & quizzes] minimum score errorI’ve downloaded the repo with proxy.
But there’s an error and I can find the function in vendor/phpunit/phpunit-php52/PHPUnit/Util/Filesystem.php
kyle@~/prj/wp/wp-testing % phpunit
PHP Fatal error: Call to undefined method PHPUnit_Util_Filesystem::fileExistsInIncludePath() in /home/kyle/prj/wp/wp-testing/vendor/phpunit/phpunit-php52/PHPUnit/Autoload.php on line 209Forum: Reviews
In reply to: [Chained Quiz] Just what I looked forHi prosunsen,
I send you a Chinese translation.Forum: Plugins
In reply to: [Psychological tests & quizzes] minimum score errorSorry, I have to give up phpunit because of my network.
Failed: [Symfony\Component\Process\Exception\ProcessTimedOutException] The process “git clone –no-checkout ‘git://github.com/garex/phpunit’ ‘/home/kyle/prj/wp-testing/vendor/phpunit/phpunit-php52’ && cd ‘/home/kyle/prj/wp-testing/vendor/phpunit/phpunit-php52’ && git remote add composer ‘git://github.com/garex/phpunit’ && git fetch composer” exceeded the timeout of 300 seconds.
Forum: Plugins
In reply to: [Psychological tests & quizzes] minimum score errorOK, I’ll have a try.
I use arch linux.Forum: Plugins
In reply to: [Psychological tests & quizzes] minimum score errorBut I don’t know how to run phpunit. Error happens:
PHP Warning: require_once(/home/osfans/prj/wp-testing/tests/phpunit/../../vendor/autoload_52.php): failed to open stream: No such file or directory in /home/osfans/prj/wp-testing/tests/phpunit/bootstrap.php on line 2
I fix the bug as follows.
diff --git a/db/sql/scale-max-right.sql b/db/sql/scale-max-right.sql index 451aba0..6a9e197 100644 --- a/db/sql/scale-max-right.sql +++ b/db/sql/scale-max-right.sql @@ -1,6 +1,6 @@ SELECT scale_id, - MIN(minimum_in_row) AS minimum_in_column, + SUM(minimum_in_row) AS minimum_in_column, SUM(maximum_in_row) AS maximum_in_column, SUM(sum_in_row) AS sum_in_column FROM ( diff --git a/src/Model/Test.php b/src/Model/Test.php index 7777fa4..943aa95 100644 --- a/src/Model/Test.php +++ b/src/Model/Test.php @@ -93,7 +93,7 @@ class WpTesting_Model_Test extends WpTesting_Model_AbstractModel $result = $db->translatedQuery(' SELECT scale_id, - MIN(minimum_in_row) AS minimum_in_column, + SUM(minimum_in_row) AS minimum_in_column, SUM(maximum_in_row) AS maximum_in_column, SUM(sum_in_row) AS sum_in_column FROM (
Forum: Plugins
In reply to: [Psychological tests & quizzes] minimum score errorI’m not sure of the meaning of PR. So what does PR mean?
Forum: Plugins
In reply to: [Psychological tests & quizzes] minimum score errorHere’s a simple test case (1 scale(X), 2 questions(Q1 Q2) and 2 answers(Y N))
Q1:1 -1
Q2:1 -1When I choose N for Q1 and Q2, exception happens in setValue and no result shows.
Scale value -2 must be within range from -1 to 2
Forum: Plugins
In reply to: [Psychological tests & quizzes] minimum score errorI think the minimum should be the sum of every min score, not the min of all scores, since the value here is the sum score of a scale.
I comment out these lines and the result page appears.
if (!($this->minimum <= $value) || !($value <= $this->maximum)) { throw new InvalidArgumentException('Scale value ' . $value . ' must be within range from ' . $this->minimum . ' to ' . $this->maximum); }
Forum: Plugins
In reply to: [Psychological tests & quizzes] minimum score errorIt seems to be caused by SQL in buildScalesWithRange()
1. There are 8 questions, 4 answers(ABCD) and 3 scales(XYZ).
- X: 2 1 -1 -2
- X: 2 1 -1 -2
- X: 2 1 -1 -2
- X: 2 1 -1 -2
- Y: -4 -2 0 2
- Y: -1 0 1 2
- Y: -4 -2 2 4
- Z: -8 -4 4 8
So,
sum(min(X))=-8
sum(min(Y))=-9
sum(min(Z))=-83. My debug code:
public function setValue($value) { $value = $this->filterValue($value, 'value'); echo('Scale value ' . $value . ' must be within range from ' . $this->minimum . ' to ' . $this->maximum."\n"); if (!($this->minimum <= $value) || !($value <= $this->maximum)) { throw new InvalidArgumentException('Scale value ' . $value . ' must be within range from ' . $this->minimum . ' to ' . $this->maximum); } $this->value = $value; return $this; }
Forum: Plugins
In reply to: [Psychological tests & quizzes] question order & optional questionMaybe there could be a source-code edit mode besides GUI mode.
In the mode, we can reorder questions, modify formula, customize result description, etc.