Merge pull request #2466 from rickosborne/storygraph-csv-isbn

StoryGraph import ISBN tweak
This commit is contained in:
Mouse Reeve 2022-12-04 11:31:12 -08:00 committed by GitHub
commit c4d252754e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 10 deletions

View file

@ -16,8 +16,8 @@ class Importer:
("id", ["id", "book id"]),
("title", ["title"]),
("authors", ["author", "authors", "primary author"]),
("isbn_10", ["isbn10", "isbn"]),
("isbn_13", ["isbn13", "isbn", "isbns"]),
("isbn_10", ["isbn10", "isbn", "isbn/uid"]),
("isbn_13", ["isbn13", "isbn", "isbns", "isbn/uid"]),
("shelf", ["shelf", "exclusive shelf", "read status", "bookshelf"]),
("review_name", ["review name"]),
("review_body", ["my review", "review"]),

View file

@ -1,3 +1,3 @@
Title,Authors,Contributors,ISBN,Format,Read Status,Date Added,Last Date Read,Dates Read,Read Count,Moods,Pace,Character- or Plot-Driven?,Strong Character Development?,Loveable Characters?,Diverse Characters?,Flawed Characters?,Star Rating,Review,Content Warnings,Content Warning Description,Tags,Owned?
Always Coming Home,"Ursula K. Le Guin, Todd Barton, Margaret Chodos-Irvine","",,,to-read,2021/05/10,"","",0,"",,,,,,,,,"",,"",No
Subprime Attention Crisis,Tim Hwang,"",,,read,2021/05/10,"","",1,informative,fast,,,,,,5.0,"","","","",No
Title,Authors,Contributors,ISBN/UID,Format,Read Status,Date Added,Last Date Read,Dates Read,Read Count,Moods,Pace,Character- or Plot-Driven?,Strong Character Development?,Loveable Characters?,Diverse Characters?,Flawed Characters?,Star Rating,Review,Content Warnings,Content Warning Description,Tags,Owned?
Always Coming Home,"Ursula K. Le Guin, Todd Barton, Margaret Chodos-Irvine","",9780520227354,,to-read,2021/05/10,"","",0,"",,,,,,,,,"",,"",No
Subprime Attention Crisis,Tim Hwang,"",0374538654,,read,2021/05/10,"","",1,informative,fast,,,,,,5.0,"","","","",No

1 Title Authors Contributors ISBN ISBN/UID Format Read Status Date Added Last Date Read Dates Read Read Count Moods Pace Character- or Plot-Driven? Strong Character Development? Loveable Characters? Diverse Characters? Flawed Characters? Star Rating Review Content Warnings Content Warning Description Tags Owned?
2 Always Coming Home Ursula K. Le Guin, Todd Barton, Margaret Chodos-Irvine 9780520227354 to-read 2021/05/10 0 No
3 Subprime Attention Crisis Tim Hwang 0374538654 read 2021/05/10 1 informative fast 5.0 No

View file

@ -53,13 +53,19 @@ class StorygraphImport(TestCase):
models.ImportItem.objects.filter(job=import_job).order_by("index").all()
)
self.assertEqual(len(import_items), 2)
self.assertEqual(import_items[0].index, 0)
self.assertEqual(import_items[0].normalized_data["title"], "Always Coming Home")
self.assertEqual(import_items[1].index, 1)
always_book = import_items[0]
self.assertEqual(always_book.index, 0)
self.assertEqual(always_book.normalized_data["title"], "Always Coming Home")
self.assertEqual(always_book.isbn, "9780520227354")
subprime_book = import_items[1]
self.assertEqual(subprime_book.index, 1)
self.assertEqual(
import_items[1].normalized_data["title"], "Subprime Attention Crisis"
subprime_book.normalized_data["title"], "Subprime Attention Crisis"
)
self.assertEqual(import_items[1].normalized_data["rating"], "5.0")
self.assertEqual(subprime_book.normalized_data["rating"], "5.0")
self.assertEqual(subprime_book.isbn, "0374538654")
def test_handle_imported_book(self, *_):
"""storygraph import added a book, this adds related connections"""