Fix Bug: can't multiply sequence by non-int of type 'float'

Brightcells 6 years ago
parent
commit
acf403b925
1 changed files with 2 additions and 2 deletions
  1. 2 2
      statistic/views.py

+ 2 - 2
statistic/views.py

@@ -217,7 +217,7 @@ def ymdtj(brand_id, ymd, lastymd):
217 217
         last_scan_user_count = 0
218 218
 
219 219
     # 与上个统计周期数据的用户人数比例
220
-    user_count_increase_pct = '%.2f' % scan_user_count * 100.0 / last_scan_user_count if last_scan_user_count != 0 else 0
220
+    user_count_increase_pct = '%.2f' % (scan_user_count * 100.0 / last_scan_user_count) if last_scan_user_count != 0 else 0
221 221
 
222 222
     # 周期内镜头销售支数
223 223
     try:
@@ -231,7 +231,7 @@ def ymdtj(brand_id, ymd, lastymd):
231 231
         last_sell_volume_count = 0
232 232
 
233 233
     # 与上个统计周期数据的销售支数比例
234
-    volume_count_increase_pct = '%.2f' % sell_volume_count * 100.0 / last_sell_volume_count if last_sell_volume_count != 0 else 0
234
+    volume_count_increase_pct = '%.2f' % (sell_volume_count * 100.0 / last_sell_volume_count) if last_sell_volume_count != 0 else 0
235 235
 
236 236
     # 统计周期内型号扫描排行数据,请按顺序返回
237 237
     models = ConsumeModelSaleStatisticInfo.objects.filter(brand_id=brand_id, ymd=ymd, status=True).order_by('-num')