Browse Source

report_push: 筛选条件修改

Signed-off-by: binren <zhangbr@elab-plus.com>
binren 5 years ago
parent
commit
8fe9bfca89
1 changed files with 15 additions and 7 deletions
  1. 15 7
      report_push.py

+ 15 - 7
report_push.py

@@ -514,7 +514,7 @@ class ReportPush(object):
             else:
                 all_data_history = self.house_with_brand(xcx_top_data_all, brand_top_data_all)
                 for index, x in enumerate(all_data_history):
-                    if x[0] in house_ids:
+                    if x[1] in house_ids:
                         obj = [index]
                         obj.extend(x)
                         result_data_3.append(obj)
@@ -601,10 +601,9 @@ class ReportPush(object):
         """
         result = []
         house_ids = []
-        if brands:
-            house_ids.extend(house_ids)
         for x in xcx_top_data:
-            house_ids.append(x[0])
+            if x[0] not in house_ids:
+                house_ids.append(x[0])
         for x in brand_top_data:
             if x[1] not in house_ids:
                 house_ids.append(x[1])
@@ -615,8 +614,13 @@ class ReportPush(object):
                     a.extend(x)
             b = []
             for index, y in enumerate(brand_top_data):
-                if house_id == y[1] or house_id == y[0]:
-                    b.extend(y)
+                if brands:
+                    if house_id == y[1]:
+                        b.extend(y)
+                else:
+                    if house_id == y[1]:
+                        b.extend(y)
+
             if len(a) == 1 and len(b) == 1:
                 result.append([b[0], a[0], a[1], self.add(a[2], b[3]), self.add(a[3], b[4]), self.add(a[4], b[5]), self.add(a[5], b[6])])
             elif len(a) == 1 and len(b) == 0:
@@ -628,6 +632,10 @@ class ReportPush(object):
                 result.append(b)
             else:
                 pass
+        if brands:
+            for x in brand_top_data:
+                if x[0] in brands and x[1] < 300:
+                    result.append(x)
         result.sort(key=lambda obj: obj[2])
         result.reverse()
         return result
@@ -679,7 +687,7 @@ class ReportPush(object):
             result.append([n for n in x])
         # brand_top_data结果的结构
         #                0 a.brand_id, 集团id
-        #                1 a.house1_id, 项目id
+        #                1 a.house_id, 项目id
         #                2 a.house_name, 项目名称
         #                3 SUM(a.pv), 浏览总量
         #                4 SUM(a.uv), 浏览人数