Skip to content

Commit ae70593

Browse files
authored
Add user-impact-score to core bugs that block webcompat site reports (#2717)
1 parent b3baaeb commit ae70593

File tree

1 file changed

+23
-5
lines changed

1 file changed

+23
-5
lines changed

bugbot/rules/webcompat_score.py

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
@dataclass
1313
class Score:
14-
bucket: str
14+
bucket: Optional[str]
1515
score: str
1616

1717

@@ -78,7 +78,10 @@ def handle_bug(
7878
if scored_bugs_key in self.scored_bugs:
7979
bug_score = self.scored_bugs[scored_bugs_key]
8080

81-
if bug["cf_webcompat_score"] != bug_score.bucket:
81+
if (
82+
bug_score.bucket is not None
83+
and bug["cf_webcompat_score"] != bug_score.bucket
84+
):
8285
changes["cf_webcompat_score"] = bug_score.bucket
8386

8487
updated_user_story = self.updated_user_story(
@@ -117,6 +120,14 @@ def get_bz_params(self, date) -> dict[str, Any]:
117120
"o7": "equals",
118121
"v7": "webcompat:site-report",
119122
"f8": "CP",
123+
"f9": "OP",
124+
"f10": "product",
125+
"o10": "notequals",
126+
"v10": "Web Compatibility",
127+
"f11": "keywords",
128+
"o11": "equals",
129+
"v11": "webcompat:platform-bug",
130+
"f12": "CP",
120131
}
121132

122133
def get_bug_scores(self) -> dict[int, Score]:
@@ -125,11 +136,18 @@ def get_bug_scores(self) -> dict[int, Score]:
125136

126137
client = gcp.get_bigquery_client(project, ["cloud-platform", "drive"])
127138
query = f"""
128-
SELECT bugs.number,
139+
SELECT number,
129140
cast(buckets.score as string) as score,
130-
cast(buckets.score_bucket as string) as bucket FROM `{project}.{dataset}.site_reports_bugzilla_buckets` as buckets
131-
JOIN `{project}.{dataset}.bugzilla_bugs` as bugs ON bugs.number = buckets.number
141+
cast(buckets.score_bucket as string) as bucket
142+
FROM `{project}.{dataset}.site_reports_bugzilla_buckets` as buckets
143+
JOIN `{project}.{dataset}.bugzilla_bugs` as bugs USING(number)
132144
WHERE bugs.resolution = ""
145+
UNION ALL
146+
SELECT number,
147+
cast(score_all as string) as score,
148+
NULL as bucket
149+
FROM `{project}.{dataset}.core_bugs_scores`
150+
WHERE resolution = ""
133151
"""
134152

135153
return {

0 commit comments

Comments
 (0)