Skip to content

Candidacy object returned from race_id filter on /candidates endpoint does not include "party" field #60

@lottspot

Description

@lottspot

Example request:

$ curl -s localhost:5100/api/candidates?race_id=28 | python -m json.tool
{
    "data": [
        {
            "candidacies": [
                {
                    "candidacy_order": 3,
                    "candidacy_type": "challenger",
                    "candidate_id": 94,
                    "id": 3,
                    "outcome": "upcoming",
                    "party_id": 2,
                    "race_id": 28,
                    "slug": "rebecca-rhynhart"
                }
            ],
            "candidate_order": 0,
            "district": 0,
            "fec_id": "",
            "id": 94,
            "is_active": 1,
            "name_first": "Rebecca Rhynhart",
            "name_last": "",
            "name_middle": "",
            "name_suffix": "",
            "slug": "rebecca-rhynhart",
            "social_blob": "",
            "total_money_donated": 79519.65,
            "total_money_in_pa": 0,
            "total_money_in_philly": 0,
            "total_money_out_pa": 0,
            "total_money_spent": 0,
            "website": ""
        },
        {
            "candidacies": [
                {
                    "candidacy_order": 4,
                    "candidacy_type": "challenger",
                    "candidate_id": 96,
                    "id": 4,
                    "outcome": "upcoming",
                    "party_id": 1,
                    "race_id": 28,
                    "slug": "michael-tomlinson"
                }
            ],
            "candidate_order": 0,
            "district": 0,
            "fec_id": "",
            "id": 96,
            "is_active": 1,
            "name_first": "Michael Tomlinson",
            "name_last": "",
            "name_middle": "",
            "name_suffix": "",
            "slug": "michael-tomlinson",
            "social_blob": "",
            "total_money_donated": 712.0,
            "total_money_in_pa": 0,
            "total_money_in_philly": 0,
            "total_money_out_pa": 0,
            "total_money_spent": 0,
            "website": ""
        }
    ],
    "metadata": {}
}

Based on the logic which performs retrieval from the database and the definition of the Candidacy object itself I would expect the "party" field to be present on each object in the "candidacies" array. In the sample request however, it is not.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions