mirror of https://github.com/buster-so/buster.git
Merge pull request #1038 from buster-so/dallin-bus-1872-dashboard-somehow-had-null-version-in-its-version-history
dashboard version fix
This commit is contained in:
commit
73746af9fc
|
@ -51,9 +51,12 @@ function getLatestVersionNumber(versionHistory: VersionHistory | null): number {
|
||||||
if (!versionHistory || Object.keys(versionHistory).length === 0) {
|
if (!versionHistory || Object.keys(versionHistory).length === 0) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
// Get all version numbers from the record values
|
// Get all version numbers from the record values, filtering out null/undefined/NaN
|
||||||
const versionNumbers = Object.values(versionHistory).map((v) => v.version_number);
|
const versionNumbers = Object.values(versionHistory)
|
||||||
return Math.max(...versionNumbers);
|
.map((v) => v.version_number)
|
||||||
|
.filter((n) => typeof n === 'number' && !Number.isNaN(n));
|
||||||
|
|
||||||
|
return versionNumbers.length > 0 ? Math.max(...versionNumbers) : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Helper function to add dashboard version to history
|
// Helper function to add dashboard version to history
|
||||||
|
|
Loading…
Reference in New Issue