Fix for ISBN-10

This commit is contained in:
augustin64 2024-04-19 11:30:55 +02:00
parent e48339e245
commit dd07544a44
3 changed files with 7 additions and 6 deletions

View File

@ -7,8 +7,8 @@ mkdir -p data
ls data | grep "$DATABASE" > /dev/null ls data | grep "$DATABASE" > /dev/null
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
echo "Created data/books-backup.db" echo "Created data/books-backup.sqlite"
mv "data/$DATABASE" data/books-backup.db mv "data/$DATABASE" data/books-backup.sqlite
fi fi
sqlite3 "data/$DATABASE" < isbn_sort/schema.sql sqlite3 "data/$DATABASE" < isbn_sort/schema.sql

View File

@ -9,8 +9,9 @@ class Book:
try: try:
isbn = str(isbn).replace("-", "") isbn = str(isbn).replace("-", "")
int(isbn) int(isbn)
except ValueError: except ValueError: # this can be ISBN-10
raise ValueError("ISBN must be an int") pass
# raise ValueError("ISBN must be an int")
self.isbn = isbn self.isbn = isbn
self.title = None self.title = None

View File

@ -62,8 +62,8 @@
<td><p {% if book.publisher == None %}class="red"{% endif %}>{{ book.publisher }}</p></td> <td><p {% if book.publisher == None %}class="red"{% endif %}>{{ book.publisher }}</p></td>
<td><p {% if book.count != 1 %}class="red"{% endif %}>{{ book.count }}</p></td> <td><p {% if book.count != 1 %}class="red"{% endif %}>{{ book.count }}</p></td>
<td> <td>
<button class="action" onclick="openEditBookDialog({{ book.isbn }})">✏️</button> <button class="action" onclick='openEditBookDialog("{{ book.isbn }}")'>✏️</button>
<button class="action" onclick="openDeleteBookDialog({{ book.isbn }})">🗑️</button> <button class="action" onclick='openDeleteBookDialog("{{ book.isbn }}")'>🗑️</button>
</td> </td>
</tr> </tr>
{% endfor %} {% endfor %}