Show the edition statement on cards and in the library
The edition comes only from a record for this exact edition: the Library of Congress record's edition statement first, then Open Library's edition name when it is a well-formed statement. Existing books are filled in at startup without changing anything else about them. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
1 parent
e83774adbd
commit
bb46d343a8
26 files changed
+455
-34
No files matched your search
@@ -109,6 +109,12 @@ test('a database made before the hierarchy tail gets the column; old books read
|
||||
assert.equal(before.hierarchyTail, null);
|
||||
assert.equal(before.callNumber, 'GV199.42.U82 G733 1997');
|
||||
assert.deepEqual(db.listTailMissingIds(), [before.id]);
|
||||
assert.equal(before.edition, null); // the edition column was added too; old books read as not looked up
|
||||
assert.deepEqual(db.listEditionMissingIds(), [before.id]);
|
||||
assert.equal(db.updateBook(before.id, { edition: 'Third edition' })!.edition, 'Third edition');
|
||||
assert.equal(db.updateBook(before.id, { edition: '' })!.edition, '');
|
||||
assert.deepEqual(db.listEditionMissingIds(), []);
|
||||
assert.equal(db.updateBook(before.id, { edition: null })!.edition, null);
|
||||
const after = db.updateBook(before.id, { hierarchyTail: ['Utah'] })!;
|
||||
assert.deepEqual(after.hierarchyTail, ['Utah']);
|
||||
assert.equal(after.printedAt, before.printedAt);
|
||||
@@ -132,3 +138,15 @@ test('search finds an inverted stored name by its natural form', () => {
|
||||
assert.equal(db.listBooks({ q: 'allen, steve' }).length, 1);
|
||||
assert.equal(db.listBooks({ q: 'nobody' }).length, 0);
|
||||
});
|
||||
|
||||
test('edition: NULL means not looked up, empty means none, text is kept as given', () => {
|
||||
const db = openDb(':memory:');
|
||||
const a = db.insertPending({ isbn13: '9781593278281', title: 'A', status: 'resolved' }).book;
|
||||
const b = db.insertPending({ isbn13: '9780201835953', title: 'B', status: 'resolved', edition: '' }).book;
|
||||
const c = db.insertPending({ title: 'C', status: 'resolved', edition: '2nd ed.' }).book;
|
||||
assert.equal(a.edition, null);
|
||||
assert.equal(b.edition, '');
|
||||
assert.equal(c.edition, '2nd ed.');
|
||||
assert.deepEqual(db.listEditionMissingIds(), [a.id]);
|
||||
db.close();
|
||||
});
|
||||
Reference in new issue
Block a user