зеркало из https://github.com/mozilla/bugbug.git
Split date filter in fix date and creation date
This makes #2065 less confusing.
This commit is contained in:
Родитель
b31133d4b4
Коммит
abc9cc46aa
|
@ -35,12 +35,20 @@
|
|||
</label>
|
||||
<hr />
|
||||
<label
|
||||
>Start date<br />
|
||||
<input id="startDate" type="date" />
|
||||
>Fixed after<br />
|
||||
<input id="fixStartDate" type="date" />
|
||||
</label>
|
||||
<label
|
||||
>End date<br />
|
||||
<input id="endDate" type="date" />
|
||||
>Fixed before<br />
|
||||
<input id="fixEndDate" type="date" />
|
||||
</label>
|
||||
<label
|
||||
>Opened after<br />
|
||||
<input id="createStartDate" type="date" />
|
||||
</label>
|
||||
<label
|
||||
>Opened before<br />
|
||||
<input id="createEndDate" type="date" />
|
||||
</label>
|
||||
<hr />
|
||||
<label
|
||||
|
|
|
@ -33,11 +33,19 @@ let options = {
|
|||
value: null,
|
||||
type: "select",
|
||||
},
|
||||
startDate: {
|
||||
fixStartDate: {
|
||||
value: null,
|
||||
type: "text",
|
||||
},
|
||||
endDate: {
|
||||
fixEndDate: {
|
||||
value: null,
|
||||
type: "text",
|
||||
},
|
||||
createStartDate: {
|
||||
value: null,
|
||||
type: "text",
|
||||
},
|
||||
createEndDate: {
|
||||
value: null,
|
||||
type: "text",
|
||||
},
|
||||
|
@ -493,41 +501,7 @@ async function renderRiskChart(chartEl, bugSummaries) {
|
|||
);
|
||||
}
|
||||
|
||||
function filterByCreationDate(bugSummaries) {
|
||||
let startDate = getOption("startDate");
|
||||
if (startDate) {
|
||||
startDate = Temporal.PlainDate.from(startDate);
|
||||
bugSummaries = bugSummaries.filter(
|
||||
(bugSummary) =>
|
||||
Temporal.PlainDate.compare(
|
||||
getPlainDate(bugSummary.creation_date),
|
||||
startDate
|
||||
) >= 0
|
||||
);
|
||||
}
|
||||
|
||||
let endDate = getOption("endDate");
|
||||
if (endDate) {
|
||||
endDate = Temporal.PlainDate.from(endDate);
|
||||
bugSummaries = bugSummaries.filter(
|
||||
(bugSummary) =>
|
||||
Temporal.PlainDate.compare(
|
||||
getPlainDate(bugSummary.creation_date),
|
||||
endDate
|
||||
) <= 0
|
||||
);
|
||||
}
|
||||
|
||||
return bugSummaries;
|
||||
}
|
||||
|
||||
async function renderRegressionsChart(chartEl, bugSummaries) {
|
||||
bugSummaries = filterByCreationDate(bugSummaries);
|
||||
|
||||
if (bugSummaries.length == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
let minDate = getPlainDate(
|
||||
bugSummaries.reduce((minSummary, summary) =>
|
||||
Temporal.PlainDate.compare(
|
||||
|
@ -583,12 +557,6 @@ async function renderRegressionsChart(chartEl, bugSummaries) {
|
|||
}
|
||||
|
||||
async function renderTypesChart(chartEl, bugSummaries) {
|
||||
bugSummaries = filterByCreationDate(bugSummaries);
|
||||
|
||||
if (bugSummaries.length == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
let minDate = getPlainDate(
|
||||
bugSummaries.reduce((minSummary, summary) =>
|
||||
Temporal.PlainDate.compare(
|
||||
|
@ -645,8 +613,6 @@ async function renderTypesChart(chartEl, bugSummaries) {
|
|||
async function renderFixTimesChart(chartEl, bugSummaries) {
|
||||
bugSummaries = bugSummaries.filter((bugSummary) => bugSummary.date !== null);
|
||||
|
||||
bugSummaries = filterByCreationDate(bugSummaries);
|
||||
|
||||
if (bugSummaries.length == 0) {
|
||||
return;
|
||||
}
|
||||
|
@ -824,36 +790,62 @@ async function renderUI(rerenderSummary = true) {
|
|||
);
|
||||
}
|
||||
|
||||
let startDate = getOption("startDate");
|
||||
if (startDate) {
|
||||
startDate = Temporal.PlainDate.from(startDate);
|
||||
let fixStartDate = getOption("fixStartDate");
|
||||
if (fixStartDate) {
|
||||
fixStartDate = Temporal.PlainDate.from(fixStartDate);
|
||||
bugSummaries = bugSummaries.filter((bugSummary) => {
|
||||
if (!bugSummary.date) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return (
|
||||
Temporal.PlainDate.compare(
|
||||
getPlainDate(
|
||||
bugSummary.date ? bugSummary.date : bugSummary.creation_date
|
||||
),
|
||||
startDate
|
||||
getPlainDate(bugSummary.date),
|
||||
fixStartDate
|
||||
) >= 0
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
let endDate = getOption("endDate");
|
||||
if (endDate) {
|
||||
endDate = Temporal.PlainDate.from(endDate);
|
||||
let fixEndDate = getOption("fixEndDate");
|
||||
if (fixEndDate) {
|
||||
fixEndDate = Temporal.PlainDate.from(fixEndDate);
|
||||
bugSummaries = bugSummaries.filter((bugSummary) => {
|
||||
if (!bugSummary.date) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return (
|
||||
Temporal.PlainDate.compare(
|
||||
getPlainDate(
|
||||
bugSummary.date ? bugSummary.date : bugSummary.creation_date
|
||||
),
|
||||
endDate
|
||||
) <= 0
|
||||
Temporal.PlainDate.compare(getPlainDate(bugSummary.date), fixEndDate) <=
|
||||
0
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
let createStartDate = getOption("createStartDate");
|
||||
if (createStartDate) {
|
||||
createStartDate = Temporal.PlainDate.from(createStartDate);
|
||||
bugSummaries = bugSummaries.filter(
|
||||
(bugSummary) =>
|
||||
Temporal.PlainDate.compare(
|
||||
getPlainDate(bugSummary.creation_date),
|
||||
createStartDate
|
||||
) >= 0
|
||||
);
|
||||
}
|
||||
|
||||
let createEndDate = getOption("createEndDate");
|
||||
if (createEndDate) {
|
||||
createEndDate = Temporal.PlainDate.from(createEndDate);
|
||||
bugSummaries = bugSummaries.filter(
|
||||
(bugSummary) =>
|
||||
Temporal.PlainDate.compare(
|
||||
getPlainDate(bugSummary.creation_date),
|
||||
createEndDate
|
||||
) <= 0
|
||||
);
|
||||
}
|
||||
|
||||
if (testingTags) {
|
||||
const includeUnknownTestingTags = testingTags.includes("unknown");
|
||||
const includeNotAvailableTestingTags = releaseVersions.includes("N/A");
|
||||
|
|
Загрузка…
Ссылка в новой задаче