add customer details for default if there are more than one incoming lot
This commit is contained in:
parent
20ccb385d8
commit
1c82fcfa30
|
@ -1058,9 +1058,10 @@ class ExportsView(View):
|
|||
erasures.append(device.privacy)
|
||||
return erasures
|
||||
|
||||
def get_costum_details(self):
|
||||
def get_costum_details(self, erasures):
|
||||
my_data = None
|
||||
customer_details = None
|
||||
lot = None
|
||||
if hasattr(g.user, 'sanitization_entity'):
|
||||
my_data = g.user.sanitization_entity
|
||||
|
||||
|
@ -1071,6 +1072,23 @@ class ExportsView(View):
|
|||
customer_details = lot.transfer.customer_details
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
if lot or not erasures:
|
||||
return my_data, customer_details
|
||||
|
||||
init = erasures[0].device.get_set_lots()
|
||||
for e in erasures:
|
||||
init = init.intersection(e.device.get_set_lots())
|
||||
|
||||
if len(init) != 1:
|
||||
return my_data, customer_details
|
||||
|
||||
lot = init.pop()
|
||||
try:
|
||||
customer_details = lot.transfer.customer_details
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
return my_data, customer_details
|
||||
|
||||
def get_server_erasure_hosts(self, erasures):
|
||||
|
@ -1093,7 +1111,7 @@ class ExportsView(View):
|
|||
erasures[0].snapshot.version,
|
||||
)
|
||||
|
||||
my_data, customer_details = self.get_costum_details()
|
||||
my_data, customer_details = self.get_costum_details(erasures)
|
||||
|
||||
a, b = self.get_server_erasure_hosts(erasures)
|
||||
erasures_host, erasures_on_server = a, b
|
||||
|
|
|
@ -1021,6 +1021,18 @@ class Device(Thing):
|
|||
|
||||
return
|
||||
|
||||
def get_set_lots(self):
|
||||
if self.lots:
|
||||
return set(self.lots)
|
||||
|
||||
if hasattr(self, "parent") and self.parent and self.parent.lots:
|
||||
return set(self.parent.lots)
|
||||
|
||||
if self.binding:
|
||||
return self.binding.device.get_set_lots()
|
||||
|
||||
return set()
|
||||
|
||||
def __lt__(self, other):
|
||||
return self.id < other.id
|
||||
|
||||
|
|
Reference in New Issue