Skip to content

Mode format returns mode count, not the actual mode #979

@FlamingKetchup

Description

@FlamingKetchup

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 );


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

"about": "#18 format=mode",
"subject": "Example/Math/Q.19",
"assert-output": {
"to-contain": [
"1"

"page": "Example/Math/Q.19",
"contents": "{{#show: Example/Math/2 |?Has number|format=mode }}"

"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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions