Open lparsons opened 2 years ago
ToDo:
Sample.is_serum_sample
to Sample._is_serum_sample
during test fixing because I haven't implemented the update of that field yet. Change those instances backIt would probably be good to suspend cache updates (and access) during the propagation of maintained model updates, though I'm not sure how best to do that without making MaintainedModel dependent on HierCachedModel... I may be able to manually suspend cache activities in each maintained_field_function, but since the goal is to replace all those cached fields with actual fields, that would be somewhat of a waste of time... I'll just punt on this.
FEATURE REQUEST
Inspiration
Cached fields/model properties are not searchable, but the new MaintainedModel paradigm solves the same problem: it keeps fields updated when changes are made to records in related tables, and it uses real fields that are searchable.
Description
Replace all the cached fields with MaintainedModel fields. This will require modification to how MaintainedModel propagates changes. The existing case only changes from the initially changed record upward (names in TracerLabel->Tracer->Infusate). New requirements will involve downward propagation and Models without maintained fields that must pass changes up or down.
Alternatives
none
Dependencies
This issue cannot be started until the completion of the following issue(s):
395
398
477
553
Comment
C. It just occurred to me that we could make
num_tracers
a maintained field. Perhaps a new issue?_Originally posted by @hepcat72 in https://github.com/Princeton-LSI-ResearchComputing/tracebase/pull/453#discussion_r905359660_
ISSUE OWNER SECTION
Assumptions
Requirements
Limitations
Affected Components
DESIGN
Interface Change description
None
Code Change Description
The existing MaintainedModel code only propagates updates to parent records when a particular update to a model object is made, however, with
FCirc.is_last_serum_peak_group
, FCirc does not have a child record reference and additions of peakgroups to other serum samples, or additions of serum samples themselves, would necessitate changes to sibling and/or nephew records, so changes need to be able to be propagated to child records. I implemented this in such a way that if the decorator has child fields supplied to it, changes will propagate to children first (dfs) and then up to parents. Loops are prevented by passing along an updated reference that contains record signatures.Tests
FCirc.is_last
values are unchanged.Sample.is_serum_sample
is True.Animal.last_serum_sample
points to the new sample.FCirc.is_last
values related to the old serum sample are now false.FCirc.is_last
is true.