-
-
Notifications
You must be signed in to change notification settings - Fork 83
Open
Labels
Description
It seems that the mode format returns how many times the mode appears, not the actual mode itself
| $array_counted_values = array_count_values( $array_temp ); |
| $max = max( $array_counted_values ); |
| return $max; |
array_count_values gives counts as values, and max gets the max value, meaning $max is a count, not the most common property value
It seems the unit test even expects the count instead of the actual mode
SemanticResultFormats/tests/phpunit/Integration/JSONScript/TestCases/math-01.json
Lines 309 to 313 in 42c2690
| "about": "#18 format=mode", | |
| "subject": "Example/Math/Q.19", | |
| "assert-output": { | |
| "to-contain": [ | |
| "1" |
SemanticResultFormats/tests/phpunit/Integration/JSONScript/TestCases/math-01.json
Lines 94 to 95 in 42c2690
| "page": "Example/Math/Q.19", | |
| "contents": "{{#show: Example/Math/2 |?Has number|format=mode }}" |
SemanticResultFormats/tests/phpunit/Integration/JSONScript/TestCases/math-01.json
Lines 14 to 15 in 42c2690
| "page": "Example/Math/2", | |
| "contents": "[[Has number::333]]" |
The mode should be 333, the only number, but instead it expects and gets how many times 333 occurs