1313class Score :
1414 bucket : Optional [str ]
1515 score : str
16+ webcompat_priority : Optional [str ]
1617
1718
1819class WebcompatScore (BzCleaner ):
@@ -78,11 +79,12 @@ def handle_bug(
7879 if scored_bugs_key in self .scored_bugs :
7980 bug_score = self .scored_bugs [scored_bugs_key ]
8081
81- if (
82- bug_score .bucket is not None
83- and bug ["cf_webcompat_score" ] != bug_score .bucket
84- ):
85- changes ["cf_webcompat_score" ] = bug_score .bucket
82+ for key , new_value in [
83+ ("cf_webcompat_priority" , bug_score .webcompat_priority ),
84+ ("cf_webcompat_score" , bug_score .bucket ),
85+ ]:
86+ if new_value is not None and bug [key ] != new_value :
87+ changes [key ] = new_value
8688
8789 updated_user_story = self .updated_user_story (
8890 bug ["cf_user_story" ], bug_score .score
@@ -98,7 +100,7 @@ def handle_bug(
98100 return None
99101
100102 def get_bz_params (self , date ) -> dict [str , Any ]:
101- fields = ["id" , "cf_webcompat_score" , "cf_user_story" ]
103+ fields = ["id" , "cf_webcompat_score" , "cf_user_story" , "cf_webcompat_priority" ]
102104 self .scored_bugs = self .get_bug_scores ()
103105 return {
104106 "include_fields" : fields ,
@@ -138,20 +140,26 @@ def get_bug_scores(self) -> dict[int, Score]:
138140 query = f"""
139141 SELECT number,
140142 cast(buckets.score as string) as score,
141- cast(buckets.score_bucket as string) as bucket
143+ cast(buckets.score_bucket as string) as bucket,
144+ CONCAT("P", CAST(buckets.webcompat_priority AS STRING)) AS webcompat_priority
142145 FROM `{ project } .{ dataset } .site_reports_bugzilla_buckets` as buckets
143146 JOIN `{ project } .{ dataset } .bugzilla_bugs` as bugs USING(number)
144147 WHERE bugs.resolution = ""
145148 UNION ALL
146149 SELECT number,
147150 cast(score_all as string) as score,
148- NULL as bucket
151+ NULL as bucket,
152+ NULL as webcompat_priority
149153 FROM `{ project } .{ dataset } .core_bugs_scores`
150154 WHERE resolution = ""
151155 """
152156
153157 return {
154- row ["number" ]: Score (score = row ["score" ], bucket = row ["bucket" ])
158+ row ["number" ]: Score (
159+ score = row ["score" ],
160+ bucket = row ["bucket" ],
161+ webcompat_priority = row ["webcompat_priority" ],
162+ )
155163 for row in client .query (query ).result ()
156164 }
157165
0 commit comments