Browse Source

fix price_check to handle extra column in historic price query

Daniel Sheffield 2 years ago
parent
commit
de6cdadfa0
1 changed files with 5 additions and 5 deletions
  1. 5 5
      app/activities/Rating.py

+ 5 - 5
app/activities/Rating.py

@@ -15,7 +15,7 @@ class Rating(object):
             return ''
             return ''
 
 
         return df.drop(labels=[
         return df.drop(labels=[
-            'id', 'avg', 'min', 'max', 'price', 'quantity', 'ts_raw', 'product', 'category', 'group'
+            'id', 'last', 'avg', 'min', 'max', 'price', 'quantity', 'ts_raw', 'product', 'category', 'group'
         ], axis=1).to_string(header=[
         ], axis=1).to_string(header=[
             'Date', 'Store', '$/unit', 'Org',
             'Date', 'Store', '$/unit', 'Org',
         ], justify='justify-all', max_colwidth=16, index=False)
         ], justify='justify-all', max_colwidth=16, index=False)
@@ -39,15 +39,15 @@ class Rating(object):
                 p = 'badge_bad'
                 p = 'badge_bad'
         else:
         else:
             p = 'badge_neutral'
             p = 'badge_neutral'
-        
+
         for idx, (e, a) in enumerate(zip(ls, ls[1:])):
         for idx, (e, a) in enumerate(zip(ls, ls[1:])):
             if e <= _avg <= a:
             if e <= _avg <= a:
                 for c, (_idx,_) in zip(''.join(list(f'{_avg:>5.2f}')[:idx+2]), filter(lambda x: idx-2 < x[0] and x[0]>0, enumerate(chars))):
                 for c, (_idx,_) in zip(''.join(list(f'{_avg:>5.2f}')[:idx+2]), filter(lambda x: idx-2 < x[0] and x[0]>0, enumerate(chars))):
                     chars[_idx] = (p, c)
                     chars[_idx] = (p, c)
-            
+
             if current is not None and e <= current < a:
             if current is not None and e <= current < a:
                 rating[idx] = '^'
                 rating[idx] = '^'
-        
+
         chars[0] = '|'
         chars[0] = '|'
         chars[-1] = '|'
         chars[-1] = '|'
 
 
@@ -66,4 +66,4 @@ class Rating(object):
         else:
         else:
             self.text_fields['spread'].set_text('')
             self.text_fields['spread'].set_text('')
             self.text_fields['marker'].set_text('')
             self.text_fields['marker'].set_text('')
-        
+