Recalculate changelog deduplication when the filters change (#954)

This commit is contained in:
Prospector
2023-01-30 16:28:16 -08:00
committed by GitHub
parent e5dc843d6a
commit 0caa56e618
2 changed files with 18 additions and 15 deletions

View File

@@ -32,6 +32,20 @@ export default (ctx, inject) => {
inject('formatCategory', formatCategory)
inject('formatCategoryHeader', formatCategoryHeader)
inject('formatProjectStatus', formatProjectStatus)
inject('calculateDuplicates', (versions) =>
versions.map((version, index) => {
const nextVersion = versions[index + 1]
if (
nextVersion &&
version.changelog &&
nextVersion.changelog === version.changelog
) {
return { duplicate: true, ...version }
} else {
return { duplicate: false, ...version }
}
})
)
inject('computeVersions', (versions) => {
const visitedVersions = []
const returnVersions = []
@@ -52,18 +66,6 @@ export default (ctx, inject) => {
return returnVersions
.reverse()
.map((version, index) => {
const nextVersion = returnVersions[index + 1]
if (
nextVersion &&
version.changelog &&
nextVersion.changelog === version.changelog
) {
return { duplicate: true, ...version }
} else {
return { duplicate: false, ...version }
}
})
.sort(
(a, b) => ctx.$dayjs(b.date_published) - ctx.$dayjs(a.date_published)
)