Page MenuHomePhabricator

backend doesn't return results for cit=qid and dob=all
Closed, ResolvedPublicBUG REPORT

Description

https://humaniki.wmcloud.org/api/v1/gender/gap/latest/gte_one_sitelink/properties?citizenship=16&date_of_birth=all&label_lang=en

returns 0 results

https://humaniki.wmcloud.org/api/v1/gender/gap/latest/gte_one_sitelink/properties?project=afwiki&date_of_birth=all&label_lang=en

wikiProject=afwiki and date_of_birth=all returns 0 results

When date_of_birth is selected in the search set to "all" and no other metrics are searched we return results as expected

yet if you set cit=all and dob=all then the full result set is returned as expected.

Event Timeline

I have isolated this to humaniki-backends query.py we check if "all of the properties are "all"" but not just some of them.

def get_aggregations_ids(session, ordered_aggregations, non_orderable_params, as_subquery=True):
    # aggregations_id is None indicates there's no constraint on the aggregation_id
    has_no_specific_aggregation_criteria = all([v == 'all' for v in ordered_aggregations.values()])
    has_dob_criteria = any([pid in [Properties.DATE_OF_BIRTH.value, Properties.DATE_OF_DEATH.value] for pid in
                            ordered_aggregations.keys()])
    has_project_criteria = any([pid == Properties.PROJECT.value for pid in ordered_aggregations.keys()])
    if has_no_specific_aggregation_criteria:
        return None