stanley-king 2 年之前
父節點
當前提交
910a0e237e
共有 1 個文件被更改,包括 7 次插入0 次删除
  1. 7 0
      plot/refill/MProfitRatioCalc.py

+ 7 - 0
plot/refill/MProfitRatioCalc.py

@@ -49,6 +49,10 @@ class MProfitRatioCalc(MerchantCalc):
             for _mchid, _card_type, _spec, _data in gen:
                 submit_count, succ_count, fail_count, succ_ratio, profit = calc_mch_profit(_data, pos_map, start, end)
                 if _card_type is None and _spec is None:
+                    if submit_count == 0:
+                        profit += 10
+                        spec_amount += 10
+
                     profit_ratio = profit / (spec_amount + 0.000001)
                     gross[_mchid] = [submit_count, succ_count, fail_count, succ_ratio, profit, round(profit_ratio, 5)]
                     spec_amount = 0.0
@@ -56,6 +60,9 @@ class MProfitRatioCalc(MerchantCalc):
                     key = f"{_mchid}-{_card_type}-{_spec}"
                     amount = succ_count * _spec
                     spec_amount += amount
+                    if submit_count == 0:
+                        profit += 10
+                        amount += 10
                     profit_ratio = profit / (amount + 0.000001)
                     detail[key] = [submit_count, succ_count, fail_count, succ_ratio, profit, round(profit_ratio, 5)]