Commit 28cbe4ea authored by zhengjinlei's avatar zhengjinlei

统计任务

parent 909ec7bf
...@@ -43,20 +43,6 @@ def rule_stat(start_date, end_date): ...@@ -43,20 +43,6 @@ def rule_stat(start_date, end_date):
'taskId': check['taskId'], 'sessionId': check['sessionId'], 'taskId': check['taskId'], 'sessionId': check['sessionId'],
'session_table_id': check['id']} 'session_table_id': check['id']}
rules_list.append(RulesStat(**rule_obj)) rules_list.append(RulesStat(**rule_obj))
# rd = RulesStat()
# rd.create_date = start_date
# rd.sessionCollectionId = t['sessionCollectionId']
# rd.rule = name
# rd.rule_num = 1
# rd.task = t['name'].split('_')[0]
# rd.agentName = check['agentName']
# rd.customName = check['customName']
# rd.score = check['score']
# rd.remainTime = check['remainTime']
# rd.taskId = check['taskId']
# rd.sessionId = check['sessionId']
# rd.session_table_id = check['id']
# rd.save()
stat_count += 1 stat_count += 1
logger.info('统计数量为:%s' % stat_count) logger.info('统计数量为:%s' % stat_count)
RulesStat.objects.bulk_create(rules_list) RulesStat.objects.bulk_create(rules_list)
...@@ -93,21 +79,4 @@ def seat_stat(start_date, end_date): ...@@ -93,21 +79,4 @@ def seat_stat(start_date, end_date):
seat_obj = {'agentName': k} seat_obj = {'agentName': k}
seat_obj.update(v) seat_obj.update(v)
seat_list.append(SeatStat(**seat_obj)) seat_list.append(SeatStat(**seat_obj))
# seat_condition = {'create_date': start_date, 'agentName': check['agentName']}
# seats = SeatStat.objects.filter(**seat_condition)
# if seats:
# seat = seats[0]
# seat.total_session += 1
# seat.validate_session += 1 if check['violationRuleCount'] > 0 else 0
# seat.save()
# else:
# seat = SeatStat()
# seat.create_date = start_date
# seat.agentName = check['agentName']
# seat.taskId = check['taskId']
# seat.task = t['name'].split('_')[0]
# seat.sessionCollectionId = t['sessionCollectionId']
# seat.total_session = 1
# seat.validate_session = 1 if check['violationRuleCount'] > 0 else 0
# seat.save()
SeatStat.objects.bulk_create(seat_list) SeatStat.objects.bulk_create(seat_list)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment