Remove unwanted revisions for CustomerPerson etc.

This commit is contained in:
Lance Edgar 2023-06-17 16:50:39 -05:00
parent 12eeb5df97
commit b6cb119e89

View file

@ -1279,47 +1279,6 @@ class PersonView(MasterView):
.filter(cls.account_holder_uuid == person.uuid)
versions.extend(query.all())
# Customer (new-style via CustomerShopper)
cls = continuum.version_class(model.Customer)
query = self.Session.query(cls)\
.join(model.CustomerShopper,
model.CustomerShopper.customer_uuid == cls.uuid)\
.filter(model.CustomerShopper.person_uuid == person.uuid)
versions.extend(query.all())
# Customer (old-style via CustomerPerson)
cls = continuum.version_class(model.Customer)
query = self.Session.query(cls)\
.join(model.CustomerPerson, model.CustomerPerson.customer_uuid == cls.uuid)\
.filter(model.CustomerPerson.person_uuid == person.uuid)
versions.extend(query.all())
# CustomerPerson
cls = continuum.version_class(model.CustomerPerson)
query = self.Session.query(cls)\
.filter(cls.person_uuid == person.uuid)
versions.extend(query.all())
# nb. this is used in some queries below
FirstShopper = orm.aliased(model.CustomerShopper)
# CustomerShopper (from Customer perspective)
cls = continuum.version_class(model.CustomerShopper)
query = self.Session.query(cls)\
.join(model.Customer,
model.Customer.uuid == cls.customer_uuid)\
.filter(model.Customer.account_holder_uuid == person.uuid)
versions.extend(query.all())
# CustomerShopperHistory (from Customer perspective)
cls = continuum.version_class(model.CustomerShopperHistory)
query = self.Session.query(cls)\
.join(model.CustomerShopper,
model.CustomerShopper.uuid == cls.shopper_uuid)\
.join(model.Customer)\
.filter(model.Customer.account_holder_uuid == person.uuid)
versions.extend(query.all())
# CustomerShopper (from Shopper perspective)
cls = continuum.version_class(model.CustomerShopper)
query = self.Session.query(cls)\