Beispiel #1
0
 def percent_stocked_out(self, product, year, month):
     # Is this pattern confusing?
     return format_percent(
         len(self.stocked_out_of(product=product, year=year, month=month)),
         len(self.facilities))
Beispiel #2
0
 def percent_stocked_out(self, product, year, month):
     # Is this pattern confusing?
     return format_percent(len(self.stocked_out_of(product=product, year=year, month=month)), len(self.facilities))
Beispiel #3
0
 def _percent(self, fn=None, of=None):
     if not of:
         of = len(self.facilities)
     else:
         of = len(getattr(self.dg, of)(self.facilities))
     return format_percent(len(getattr(self, fn)), of)
Beispiel #4
0
 def _percent(self, fn=None, of=None):
     if not of:
         of= len(self.facilities)
     else:
         of = len(getattr(self.dg, of)(self.facilities))
     return format_percent(len(getattr(self, fn)), of)