Skip to content

Jawad A.#8

Open
jivvyjams wants to merge 1 commit intoHackYourAssignment:mainfrom
jivvyjams:main
Open

Jawad A.#8
jivvyjams wants to merge 1 commit intoHackYourAssignment:mainfrom
jivvyjams:main

Conversation

@jivvyjams
Copy link

No description provided.

@github-actions
Copy link

📝 HackYourFuture auto grade

Assignment Score: 0 / 100 ✅

Status: ✅ Passed
Minimum score to pass: 0
🧪 The auto grade is experimental and still being improved

Test Details

@mo92othman mo92othman self-assigned this Feb 21, 2026
Copy link

@mo92othman mo92othman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @jivvyjams
Overall, good work 👍

Please make sure to include the required project setup files (like package.json and .prettierrc) and test running the app yourself before submitting. These are part of the assignment requirements.

Good luck in the next modules!

Comment on lines 128 to +141
function printAllBooks() {
// TODO: Implement this function
// Loop through and display with chalk
// Use green for read books, yellow for unread
// Use cyan for titles
const books = loadBooks();

console.log("\nAll Books:");
books.forEach((b) => {
const color = b.read ? chalk.green : chalk.yellow;
const status = b.read ? "✓ Read" : "⚠ Unread";

console.log(
color(`${b.id}. `) +
chalk.cyan(b.title) +
color(` by ${b.author} (${b.genre}) ${status}`),
);
});

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

printAllBooks is defined again here. It was already defined earlier. Please keep only one version to avoid confusion and bugs.

Comment on lines 144 to +154
function printSummary() {
// TODO: Implement this function
// Show statistics with chalk
// Display total books, read count, unread count
// Use bold for stats
} No newline at end of file
const books = loadBooks();
const total = books.length;
const readCount = books.filter((b) => b.read === true).length;
const unreadCount = total - readCount;

console.log(chalk.bold("\n📊 SUMMARY 📊"));
console.log(chalk.bold(`Total Books: ${total}`));
console.log(chalk.bold(`Read: ${readCount}`));
console.log(chalk.bold(`Unread: ${unreadCount}`));
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same for this, printSummary is also defined twice. Duplicate functions make the file harder to maintain.

Comment on lines +156 to +167
module.exports = {
loadBooks,
saveBooks,
addBook,
getUnreadBooks,
getBooksByGenre,
markAsRead,
getTotalBooks,
hasUnreadBooks,
printAllBooks,
printSummary,
};

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

module.exports appears two times. Here, and previously in line 115 Keep one export block at the end of the file.

Comment on lines +40 to +44
books.forEach((book) => {
if (typeof book.id === "number" && book.id > maxId) maxId = book.id;
});
const newBook = {
id: maxId + 1,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice job generating the ID dynamically!

Comment on lines +26 to +35
if (command === "add") {
const title = process.argv[3];
const author = process.argv[4];
const genre = process.argv[5];
addBook({
title: "Nudge",
author: "Richard Thaler",
genre: "Pyschology",
});
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You read title, author, genre from CLI args, but you do not use them. Right now addBook always adds hardcoded "Nudge" values.

@@ -1,13 +1,42 @@
// This is the entrypoint for your application.
// node app.js
const chalk = require("chalk");

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

chalk is imported but never used in this file.

@mo92othman mo92othman added Reviewed This assignment has been reivewed by a mentor and a feedback has been provided and removed To review labels Feb 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Reviewed This assignment has been reivewed by a mentor and a feedback has been provided

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants