Move parent
attribute from SurveyElement
to relevant subclasses
#751
Labels
parent
attribute from SurveyElement
to relevant subclasses
#751
As noted here, not all
SurveyElement
subclasses will have a meaningful or usefulparent
assigned. This attribute should be moved to the subclasses where aparent
is relevant, so that it is clear which objects should have this property. This should also reduce memory usage by removing an unnecessary attribute descriptor from every choice item (Option
).Consideration needs to be given to methods that reference the
parent
attribute i.e. the logic within these methods, and sensible location for them - such as helper functions or a mixin class. For example inSurveyElement
,._link_children()
,.iter_ancestors()
,.to_json_dict()
, etc.From a quick look it seems like the following use
parent
:GroupedSection(name="meta")
Survey
Survey
/GroupedSection
/RepeatingSection
Survey
/GroupedSection
/RepeatingSection
Survey
/GroupedSection
/RepeatingSection
OsmUploadQuestion
The following do not:
Section
: not instantiated directly.Survey
is a subclass soparent
can't be here.Survey
: this is the top-most objectOption
: these belong to anItemset
but are not nestable likeQuestion
/GroupedSection
/RepeatingSection
.The text was updated successfully, but these errors were encountered: