Files
zentao-flow/tmp/sunying.py
T

38 lines
1.9 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# -*- coding: utf-8 -*-
import io, sys, pymysql
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
conn = pymysql.connect(host='192.168.1.161', user='devgps', password='dev@2021GPS',
database='zentao_dev_2026', charset='utf8mb4')
cur = conn.cursor()
def q(sql):
cur.execute(sql); return cur.fetchall()
print("### A. 孙颖 6月提出的所有 Bug(不限需求)")
for r in q("""SELECT id, tostory, story, severity, status, resolvedby, openeddate, LEFT(title,30)
FROM zt_bug WHERE openedby='sunying' AND deleted='0'
AND openeddate>='2026-06-01' AND openeddate<'2026-07-01' ORDER BY id"""):
print(r)
print("\n### B. 她的测试需求(24个)上挂的所有 Bug(任何人提的)")
ids = q("""SELECT DISTINCT s.id FROM zt_story s LEFT JOIN zt_story_expand e ON e.story_id=s.id
WHERE s.releaseddate>='2026-06-01' AND s.releaseddate<'2026-07-01' AND s.deleted='0'
AND (s.assignedTo='sunying' OR e.test_person LIKE '%孙颖%')""")
idlist = ','.join(str(r[0]) for r in ids)
for r in q(f"""SELECT id, tostory, severity, status, openedby, openeddate, LEFT(title,30)
FROM zt_bug WHERE tostory IN ({idlist}) AND deleted='0' ORDER BY openeddate"""):
print(r)
print("\n### C. 我早前查的2个普通Bug是哪些(story关联+severity3/4)")
for r in q(f"""SELECT id, story, tostory, severity, openedby, openeddate, LEFT(title,30)
FROM zt_bug WHERE story IN ({idlist}) AND deleted='0' AND severity IN (3,4)"""):
print(r)
print("\n### D. 弹窗口径模拟:她提的 + tostory∈24需求 + 当月 + 状态过滤")
rows = q(f"""SELECT id, severity, status, resolvedby FROM zt_bug
WHERE openedby='sunying' AND deleted='0' AND tostory IN ({idlist})
AND openeddate>='2026-06-01' AND openeddate<'2026-07-01'""")
serious = sum(1 for r in rows if r[1]==1)
slight = sum(1 for r in rows if r[1] in (2,3,4))
print(f"命中 {len(rows)} 个: 严重(sev1)={serious} 轻微(sev2/3/4)={slight}")
for r in rows: print(r)