Update models relying on history to also take into account the initial state of the bug (#1247)

Fixes #1218
This commit is contained in:
Kushagra Shekhawat 2020-01-15 16:58:46 +05:30 коммит произвёл Marco Castelluccio
Родитель e9a35eb01f
Коммит 2a573342d7
2 изменённых файлов: 44 добавлений и 25 удалений

Просмотреть файл

@ -87,24 +87,33 @@ class DevDocNeededModel(BugModel):
for bug_data in bugzilla.get_bugs():
bug_id = int(bug_data["id"])
for entry in bug_data["history"]:
for change in entry["changes"]:
# Bugs that get dev-doc-needed removed from them at some point after it's been added (this suggests a false positive among human-analyzed bugs)
if (
change["field_name"] == "keywords"
and "dev-doc-needed" in change["removed"]
and "dev-doc-complete" not in change["added"]
):
classes[bug_id] = 0
# Bugs that go from dev-doc-needed to dev-doc-complete are guaranteed to be good
# Bugs that go from not having dev-doc-needed to having dev-doc-complete are bugs
# that were missed by previous scans through content but someone realized it
# should have been flagged and updated the docs, found the docs already updated.
elif change["field_name"] == "keywords" and any(
keyword in change["added"]
for keyword in ["dev-doc-needed", "dev-doc-complete"]
):
classes[bug_id] = 1
found_dev_doc = False
if any(
keyword in bug_data["keywords"]
for keyword in ["dev-doc-needed", "dev-doc-complete"]
):
classes[bug_id] = 1
found_dev_doc = True
if not found_dev_doc:
for entry in bug_data["history"]:
for change in entry["changes"]:
# Bugs that get dev-doc-needed removed from them at some point after it's been added (this suggests a false positive among human-analyzed bugs)
if (
change["field_name"] == "keywords"
and "dev-doc-needed" in change["removed"]
and "dev-doc-complete" not in change["added"]
):
classes[bug_id] = 0
# Bugs that go from dev-doc-needed to dev-doc-complete are guaranteed to be good
# Bugs that go from not having dev-doc-needed to having dev-doc-complete are bugs
# that were missed by previous scans through content but someone realized it
# should have been flagged and updated the docs, found the docs already updated.
elif change["field_name"] == "keywords" and any(
keyword in change["added"]
for keyword in ["dev-doc-needed", "dev-doc-complete"]
):
classes[bug_id] = 1
if bug_id not in classes:
classes[bug_id] = 0

Просмотреть файл

@ -79,13 +79,23 @@ class QANeededModel(BugModel):
for bug_data in bugzilla.get_bugs():
bug_id = int(bug_data["id"])
for entry in bug_data["history"]:
for change in entry["changes"]:
if any(
change["added"].startswith(label)
for label in ["qawanted", "qe-verify", "qaurgent"]
):
classes[bug_id] = 1
found_qa = False
if any(
keyword.startswith(label)
for keyword in bug_data["keywords"]
for label in ["qawanted", "qe-verify", "qaurgent"]
):
classes[bug_id] = 1
found_qa = True
if not found_qa:
for entry in bug_data["history"]:
for change in entry["changes"]:
if any(
change["added"].startswith(label)
for label in ["qawanted", "qe-verify", "qaurgent"]
):
classes[bug_id] = 1
if bug_id not in classes:
classes[bug_id] = 0