Skip to content

Commit bbb912d

Browse files
move data files to correct folder
1 parent b7f5a42 commit bbb912d

2 files changed

Lines changed: 8 additions & 8 deletions

File tree

script.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ let libraryData = [];
33
let currentPage = 1;
44
const booksPerPage = 9; // Display 9 books per page for a card layout
55

6-
fetch('library.json')
6+
fetch('data/library.json') // Update the path to include the "data" folder
77
.then(response => response.json())
88
.then(data => {
99
libraryData = data;
10-
displayBooks();
11-
});
10+
displayBooks();
11+
});
1212

1313
require('dotenv').config(); // Load environment variables from .env file
1414

update_library.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
user = data["user"]
1111
action = data["action"]
1212

13-
# Load library data
14-
with open("data/library.json", "r") as f:
13+
# Load library data from the "data" folder
14+
with open("data/library.json", "r") as f: # Updated path
1515
books = json.load(f)
1616

1717
# Update book status
@@ -24,11 +24,11 @@
2424
book["Status"] = "Available"
2525
book["User"] = ""
2626

27-
# Save updated library data
28-
with open("data/library.json", "w") as f:
27+
# Save updated library data to the "data" folder
28+
with open("data/library.json", "w") as f: # Updated path
2929
json.dump(books, f, indent=2)
3030

31-
with open("data/library.csv", "w", newline="") as f:
31+
with open("data/library.csv", "w", newline="") as f: # Updated path
3232
writer = csv.DictWriter(f, fieldnames=["Book Title", "Author", "Barcode", "Status", "User"])
3333
writer.writeheader()
3434
writer.writerows(books)

0 commit comments

Comments
 (0)