Skip to content

Refactoring bug, searches stats field #1147

@bazineta

Description

@bazineta

There appears to be bug in the 'searches' stat as a result of 56aba08.

It's here:

const int64_t avg_tens = (stat->total == 0 ? 0 : (stat->total*10 / stat->total));

const int64_t avg_tens = (stat->total == 0 ? 0 : (stat->total*10 / stat->total));

If total is zero, then avg_tens is 0. If total is non-zero, avg_tens is 10; we're multiplying total by 10 and dividing it by itself.

Prior to the refactoring in that commit, the searches field was a tuple, containing a count and a total, and the math used to be:

const int64_t avg_tens = (stat->count == 0 ? 0 : (stat->total*10 / stat->count));

@daanx Not sure what the correct course of action is here -- should this be divided by some other field now?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions