Skip to content

Commit dc78e13

Browse files
committed
show missing functor data
1 parent 1cd02ff commit dc78e13

3 files changed

Lines changed: 36 additions & 2 deletions

File tree

src/components/FunctorList.svelte

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import type { FunctorShort } from '$lib/commons/types'
55
66
type Props = {
7-
functors: FunctorShort[]
7+
functors: (FunctorShort & { count?: number })[]
88
}
99
1010
let { functors }: Props = $props()
@@ -17,6 +17,9 @@
1717
<a href="/functor/{functor.id}">
1818
{functor.name}
1919
</a>
20+
{#if functor.count !== undefined}
21+
<span class="count">({functor.count})</span>
22+
{/if}
2023
</li>
2124
{/each}
2225
</ul>
@@ -28,4 +31,8 @@
2831
ul {
2932
margin-block: 1rem;
3033
}
34+
35+
.count {
36+
color: var(--secondary-text-color);
37+
}
3138
</style>

src/routes/missing/+page.server.ts

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { batch } from '$lib/server/db'
22
import sql from 'sql-template-tag'
3-
import type { CategoryShort } from '$lib/commons/types'
3+
import type { CategoryShort, FunctorShort } from '$lib/commons/types'
44
import { error } from '@sveltejs/kit'
55
import { get_missing_combinations } from '$lib/server/consistency'
66

@@ -13,6 +13,7 @@ export const load = async () => {
1313
CategoryShort & { count: number },
1414
CategoryShort & { count: number },
1515
CategoryPairShort,
16+
FunctorShort & { count: number },
1617
]
1718
>([
1819
// missing special morphisms
@@ -69,6 +70,18 @@ export const load = async () => {
6970
END
7071
) = 0;
7172
`,
73+
// functors with unknown properties
74+
sql`
75+
SELECT f.id, f.name, COUNT(*) AS count
76+
FROM functors f
77+
INNER JOIN functor_properties p
78+
LEFT JOIN functor_property_assignments fp
79+
ON fp.functor_id = f.id
80+
AND fp.property_id = p.id
81+
WHERE fp.property_id IS NULL
82+
GROUP BY f.id
83+
ORDER BY lower(f.name);
84+
`,
7285
])
7386

7487
if (err) error(500, 'Failed to load data')
@@ -78,6 +91,7 @@ export const load = async () => {
7891
categories_with_unknown_properties,
7992
categories_with_unreasoned_properties,
8093
undistinguishable_category_pairs,
94+
functors_with_unknown_properties,
8195
] = results
8296

8397
const missing_combinations = await get_missing_combinations()
@@ -87,6 +101,7 @@ export const load = async () => {
87101
categories_with_missing_morphisms,
88102
categories_with_unreasoned_properties,
89103
undistinguishable_category_pairs,
104+
functors_with_unknown_properties,
90105
missing_combinations,
91106
}
92107
}

src/routes/missing/+page.svelte

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<script lang="ts">
22
import CategoryList from '$components/CategoryList.svelte'
3+
import FunctorList from '$components/FunctorList.svelte'
34
import MetaData from '$components/MetaData.svelte'
45
import { get_property_url } from '$lib/commons/property.url'
56
@@ -108,6 +109,17 @@
108109
{/if}
109110
</section>
110111

112+
<section>
113+
<h3>Functors with unknown properties</h3>
114+
115+
<p class="hint">
116+
There are {data.functors_with_unknown_properties.length} categories that have some unknown
117+
properties.
118+
</p>
119+
120+
<FunctorList functors={data.functors_with_unknown_properties} />
121+
</section>
122+
111123
<style>
112124
.combinations {
113125
margin-top: 0.5rem;

0 commit comments

Comments
 (0)