fix(ci): typed card points, the managed take route, and the failing card tests and ratchets

This commit is contained in:
Maurice
2026-10-22 16:21:20 +02:00
parent fd01a090fc
commit d8bd6ab9e2
77 changed files with 293 additions and 244 deletions
+5 -6
View File
@@ -224,11 +224,7 @@ describe('pickBookPhotos', () => {
it('PHOTOPICK-010: without signals a caption wins, then a photo the book does not have yet, best first', () => {
const result = pickBookPhotos(
[
at(1, '09:00:00', { inBook: true }),
at(2, '10:00:00'),
at(3, '11:00:00', { caption: 'Tram 28', inBook: true }),
],
[at(1, '09:00:00', { inBook: true }), at(2, '10:00:00'), at(3, '11:00:00', { caption: 'Tram 28', inBook: true })],
[],
{ limit: 2 },
);
@@ -342,7 +338,10 @@ describe('pickBookPhotos', () => {
expect(ids(one)).toEqual([[101]]);
expect(one.groups[0]?.dropped).toHaveLength(30);
expect(one.groups[0]?.dropped_more).toBe(5);
const five = pickBookPhotos([1, 2, 3, 4, 5].flatMap((day) => burst(day, 31)), []);
const five = pickBookPhotos(
[1, 2, 3, 4, 5].flatMap((day) => burst(day, 31)),
[],
);
expect(bookPhotoSuggestionsSchema.parse(five)).toEqual(five);
expect(five.groups.map((g) => [g.dropped.length, g.dropped_more])).toEqual([
[30, 0],
+5 -2
View File
@@ -258,7 +258,10 @@ export function pickBookPhotos(
const chosen = filterFor(placed, options, byEntry);
const groups = groupByDayAndPlace(chosen);
const judged = groups.map((g) => judge(g, purpose, median));
const shown = takeRoundRobin(judged.map((j) => j.picks), limit);
const shown = takeRoundRobin(
judged.map((j) => j.picks),
limit,
);
const out: BookPhotoSuggestions['groups'] = [];
let groupsMore = 0;
let droppedRoom: number = PHOTO_PICK.droppedTotal;
@@ -417,7 +420,7 @@ function similarSets(members: readonly Placed[]): Placed[][] {
let r = i;
while (parent[r] !== r) r = parent[r] ?? r;
// Every index on the way now points straight at the root.
for (let k = i; parent[k] !== r; ) {
for (let k = i; parent[k] !== r;) {
const next = parent[k] ?? r;
parent[k] = r;
k = next;