-
Notifications
You must be signed in to change notification settings - Fork 13
Add an option to scrape all Bugzilla flags. #28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -294,7 +294,7 @@ var MyQOnly = { | |
async updateBugzilla(settings) { | ||
let apiKey = settings.apiKey; | ||
if (!apiKey) { | ||
return { reviewTotal: 0, needinfoTotal: 0, }; | ||
return { review: 0, needinfo: 0, }; | ||
} | ||
|
||
// I'm not sure how much of this is necessary - I just looked at what | ||
|
@@ -326,19 +326,31 @@ var MyQOnly = { | |
if (bugzillaData.error) { | ||
throw new Error(`Bugzilla request failed: ${bugzillaData.error.message}`); | ||
} | ||
let reviewTotal = | ||
|
||
if (settings.allBugzillaFlags) { | ||
let flagCounts = {}; | ||
bugzillaData.result.result.requestee.map(f => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure we need to use a let flagCounts = {};
for (let flag of bugzillaData.result.result.requestee) {
if (!(f.type in flagCounts)) {
flagCounts[f.type] = 0;
}
flagCounts[f.type]++;
}
return flagCounts; |
||
if (!(f.type in flagCounts)) { | ||
flagCounts[f.type] = 0; | ||
} | ||
flagCounts[f.type]++; | ||
}); | ||
return flagCounts; | ||
} | ||
|
||
let review = | ||
bugzillaData.result.result.requestee.filter(f => { | ||
return f.type == "review"; | ||
}).length; | ||
|
||
let needinfoTotal = 0; | ||
let needinfo = 0; | ||
if (settings.needinfos) { | ||
needinfoTotal =bugzillaData.result.result.requestee.filter(f => { | ||
needinfo = bugzillaData.result.result.requestee.filter(f => { | ||
return f.type == "needinfo"; | ||
}).length; | ||
} | ||
|
||
return { reviewTotal, needinfoTotal, }; | ||
return { review, needinfo, }; | ||
}, | ||
|
||
async updateGitHub(settings) { | ||
|
@@ -495,7 +507,9 @@ var MyQOnly = { | |
total += state.data.reviewTotal || 0; | ||
|
||
if (state.type == "bugzilla") { | ||
total += state.data.needinfoTotal || 0; | ||
for (let count of Object.values(state.data)) { | ||
total += count; | ||
} | ||
} | ||
} | ||
|
||
|
@@ -521,10 +535,9 @@ var MyQOnly = { | |
} | ||
case "bugzilla": { | ||
data = await this.updateBugzilla(service.settings); | ||
console.log(`Found ${data.reviewTotal} Bugzilla reviews ` + | ||
"to do"); | ||
console.log(`Found ${data.needinfoTotal} Bugzilla needinfos ` + | ||
"to do"); | ||
for (let [flag, count] of Object.entries(data)) { | ||
console.log(`Found ${count} Bugzilla ${flag}s to do`); | ||
} | ||
break; | ||
} | ||
case "github": { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,6 +38,10 @@ <h3>Bugzilla</h3> | |
<div class="service-settings" data-type="bugzilla"> | ||
<label for="bugzilla-apiKey">API Key</label> | ||
<input type="password" id="bugzilla-apiKey" data-setting="apiKey"/> | ||
<div class="form-rows"> | ||
<input type="checkbox" id="bugzilla-allBugzillaFlags" data-setting="allBugzillaFlags"> | ||
<label for="bugzilla-allBugzillaFlags">Count all Bugzilla Flags (implies "Count open needinfos too")</label> | ||
</div> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Presumably, the flags we care about are:
Can we have those as individual entries instead? |
||
<div class="form-rows"> | ||
<input type="checkbox" id="bugzilla-needinfos" data-setting="needinfos"> | ||
<label for="bugzilla-needinfos">Count open needinfos too</label> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we have the data, I guess we might as well do this count-up, regardless of whether or not this setting is set.