diff --git a/os-checks/pages/index.vue b/os-checks/pages/index.vue index 75a2a0b..57f29f3 100644 --- a/os-checks/pages/index.vue +++ b/os-checks/pages/index.vue @@ -265,7 +265,7 @@ $fetch(docs_json_url).then(val => docs.value = val); const summaryTable = computed(() => { const value = summaries.value.map(val => { - return Object.entries(val.pkgs).map(([name, pkg]) => { + return Object.entries(val.pkgs ?? {}).map(([name, pkg]) => { let testcases_color = null; if (pkg.testcases?.pkg_tests_count) { if (pkg.testcases?.failed === 0) { @@ -457,7 +457,7 @@ watch(selectedPkg, val => { const pkg = summaries.value .find(summary => summary.user === val.user && summary.repo === val.repo) - ?.pkgs[val.pkg]; + ?.pkgs?.[val.pkg]; if (!pkg) { return; } diff --git a/os-checks/shared/info.ts b/os-checks/shared/info.ts index 94aff69..f2fd3db 100644 --- a/os-checks/shared/info.ts +++ b/os-checks/shared/info.ts @@ -3,7 +3,16 @@ import { type Col, Cols } from "./columns-select" export type PkgInfo = { user: string, repo: string, - pkgs: { [key: string]: Pkg } + timestamp: TimeStamp, + // good repo: pkgs and err are exclusive + pkgs?: { [key: string]: Pkg }, + // compilation error + err?: string, +} + +export type TimeStamp = { + start: number, + end: number, } export type Pkg = { @@ -58,12 +67,12 @@ export type TestCase = { } export function unique_field(summaries: PkgInfo[], cb: (_: Pkg) => string[]): string[] { - const arr = summaries.map(s => Object.values(s.pkgs).map(pkg => cb(pkg).flat()).flat()).flat(); + const arr = summaries.map(s => Object.values(s.pkgs ?? {}).map(pkg => cb(pkg).flat()).flat()).flat(); return [...new Set(arr)].sort(); } export function unique_field_bool(summaries: PkgInfo[], cb: (_: Pkg) => boolean): boolean { - const arr = summaries.filter(s => Object.values(s.pkgs).filter(cb).length > 0) + const arr = summaries.filter(s => Object.values(s.pkgs ?? {}).filter(cb).length > 0) return arr.length > 0; } diff --git a/os-checks/shared/testcases.ts b/os-checks/shared/testcases.ts index 462c22c..525a12d 100644 --- a/os-checks/shared/testcases.ts +++ b/os-checks/shared/testcases.ts @@ -102,7 +102,7 @@ export function summariesToTestResult(pkg_info: PkgInfo[]): TestResult[] { let idx = 0; for (const info of pkg_info) { - for (const [pkg, value] of Object.entries(info.pkgs)) { + for (const [pkg, value] of Object.entries(info.pkgs ?? {})) { for (const test of value.testcases?.tests || []) { for (const testcase of test.testcases) { result.push({