Open fwimp opened 2 months ago
It works with expand_taxa=1
, e.g: https://www.onezoom.org/popularity/list?otts=247341,563159,269666,504327,668392&key=0&expand_taxa=1&spread_taxa_evenly=0&taxon_names=0&include_raw=1
Not sure if this is helps you out, but at least helps pinpoint where the bug is.
Thanks. Well spotted. Should be an easy fix.
Updated the initial example to have an example consistent with what is returned when expand_taxa=1
Looks like the issue here is from a hardcoded list of column names in the popularity controller
If queryvar_is_true("expand_taxa")
is set to True then the default header column constructed
beforehand is used (as there is nothing that resets it in the ret
dictionary):
https://github.com/OneZoom/OZtree/blob/118bfba9b122d812386e438fb6d6b29cb51aed7e/controllers/popularity.py#L192-L197
However if queryvar_is_true("expand_taxa")
is set to False, that branch resets the header entry of ret
using a hardcoded list, which does not account for the possibility that include_raw
is True.
I thiiiink that lines 265-270 can just be deleted as they also have an unused variable that looks like it was there from some old code.
If you hit the popularity endpoint, it does not return a header value for popularity_raw even when you request it by specifying include_raw.
For example
https://www.onezoom.org/popularity/list?otts=247341,563159,269666,504327,668392&key=0&expand_taxa=0&spread_taxa_evenly=0&taxon_names=0&include_raw=1
returns
When it should return