Преглед на файлове

修复全球数据重复问题

peng преди 2 години
родител
ревизия
5bfc7e9590
променени са 1 файла, в които са добавени 32 реда и са изтрити 29 реда
  1. 32 29
      AdminController/dataSystemManagement/HomeDataController.py

+ 32 - 29
AdminController/dataSystemManagement/HomeDataController.py

@@ -275,37 +275,39 @@ class HomeDataView(View):
                                 break
                         if flag == 0:
                             user_all_temp_list.append(item)
-                    if user_increase_temp_list:
-                        for item in user_increase_temp_list:
-                            if user_increase_count:
-                                rate = round(item['count'] / user_increase_count * 100, 2)
-                            else:
-                                rate = 0
-                            if rate >= 10:
-                                item['rate'] = rate
-                                user_increase_list.append(item)
-                            else:
-                                user_increase_other_dict['count'] += item['count']
-                        if user_increase_count:
-                            user_increase_other_dict['rate'] = round(
-                                user_increase_other_dict['count'] / user_increase_count * 100, 2)
-                        user_increase_list.append(user_increase_other_dict)
-                    if user_all_temp_list:
-                        for item in user_all_temp_list:
-                            if user_all_count:
-                                rate = round(item['count'] / user_all_count * 100, 2)
-                            else:
-                                rate = 0
-                            if rate >= 10:
-                                item['rate'] = rate
-                                user_all_list.append(item)
-                            else:
-                                user_all_other_dict['count'] += item['count']
-                        if user_all_count:
-                            user_all_other_dict['rate'] = round(user_all_other_dict['count'] / user_all_count * 100, 2)
-                        user_all_list.append(user_all_other_dict)
                 else:
                     return response.json(result['result_code'], result['result'])
+            if user_increase_temp_list:
+                for item in user_increase_temp_list:
+                    if user_increase_count:
+                        rate = round(item['count'] / user_increase_count * 100, 2)
+                    else:
+                        rate = 0
+                    if rate >= 10:
+                        item['rate'] = rate
+                        user_increase_list.append(item)
+                    else:
+                        user_increase_other_dict['count'] += item['count']
+                if user_increase_count:
+                    user_increase_other_dict['rate'] = round(
+                        user_increase_other_dict['count'] / user_increase_count * 100, 2)
+                if user_increase_other_dict['count']:
+                    user_increase_list.append(user_increase_other_dict)
+            if user_all_temp_list:
+                for item in user_all_temp_list:
+                    if user_all_count:
+                        rate = round(item['count'] / user_all_count * 100, 2)
+                    else:
+                        rate = 0
+                    if rate >= 10:
+                        item['rate'] = rate
+                        user_all_list.append(item)
+                    else:
+                        user_all_other_dict['count'] += item['count']
+                if user_all_count:
+                    user_all_other_dict['rate'] = round(user_all_other_dict['count'] / user_all_count * 100, 2)
+                if user_all_other_dict['count']:
+                    user_all_list.append(user_all_other_dict)
             res = {
                 'userIncreaseCount': user_increase_count,
                 'userActiveCount': user_active_count,
@@ -353,6 +355,7 @@ class HomeDataView(View):
                         for each in order_list:
                             if item['startTime'] == each['startTime'] and item['endTime'] == each['endTime']:
                                 each['total'] += item['total']
+                                flag = 1
                                 break
                         if flag == 0:
                             order_list.append(item)