Skip to content

Five membership checks use ' Dairy cows, tied housing' (leading space) and never match the tied-housing class (SALCAanimal_ls.py:885, 1290, 1430, 1568, 1605) #5

Description

@mklarmann

Hi team — heads-up on a leading-space typo that silently misroutes tied-housing dairy cows.

The tied-housing subclass is assigned the canonical value at SALCAanimal/SALCAanimal_ls.py:650:

650  animal.animal_class = 'Dairy cows, tied housing'

and most checks match it correctly (no leading space), e.g. lines 652, 972, 1002, 1045, 1113, 1229, 1244. However, five if animal.animal_class in [...] lists instead contain ' Dairy cows, tied housing' with a leading space — lines 885, 1290, 1430, 1568, 1605:

885  if animal.animal_class in ['Dairy cows', ' Dairy cows, tied housing',

' Dairy cows, tied housing' != 'Dairy cows, tied housing', so for tied-housing dairy cows these five branches never fire and fall through to their else / non-cattle (pig) path. Because plain 'Dairy cows' is present in all five lists, only the tied-housing subclass is misrouted (regular loose-housing dairy cows are unaffected), which makes this easy to miss.

Why it's a bug: tied-housing dairy cows take the wrong emission/processing branch in five places, silently and only for that subclass.

Fix — remove the leading space in all five lists so they read 'Dairy cows, tied housing', matching the value assigned at line 650. Optionally, normalizing at assignment (animal.animal_class = 'Dairy cows, tied housing'.strip() or comparing with .strip()) would harden against this class of typo. Thanks!

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