Skip to content

Conversation

@farchettiensis
Copy link

Checklist:

References this issue.

@jdwilkin4
Copy link
Contributor

Please confirm where this workshop is supposed to go in the curriculum.
The objects module? JS fundamentals? somewhere else?
We need to know that information in order to review this properly.

@majestic-owl448
Copy link
Contributor

Naomi's plan says here:

         {
           "dashedName": "javascript-objects",
           "blocks": [
             "lecture-introduction-to-javascript-objects-and-their-properties",
+            "workshop-heritage-library-catalog",
             "lecture-working-with-json",
+            "lab-cargo-manifest-parser",
             "lecture-working-with-optional-chaining-and-object-destructuring",
+            "workshop-smart-campus-directory",
             "workshop-recipe-tracker",
+            "lab-device-loan-ledger",
             "lab-quiz-game",
+            "lab-nutrient-tracker-dictionary",
             "lab-record-collection",
+            "workshop-artifact-provenance-auditor",
             "review-javascript-objects",
             "quiz-javascript-objects"
           ]
         },

Copy link
Contributor

@jdwilkin4 jdwilkin4 left a comment

Choose a reason for hiding this comment

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

Did a first pass through the prototype and found a lot of methods that haven't been taught yet based on where this is supposed to go in the curriculum.

If this is supposed to go in the object module, then you will need to refactor the project to fit the concepts already taught.

Otherwise, you will need to talk with Naomi on if she wants this moved to another module.

Based on the methods you chose, if this were moved, it would have to be the higher order functions module.

// teaching: string split(), trim(), converting types
function parseCard(rawString) {
// split by pipe delimiter and trim whitespace
const parts = rawString.split("|").map(part => part.trim());
Copy link
Contributor

Choose a reason for hiding this comment

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

map won't be taught till later.
so this needs to be refactored.

// step 2: Parse entire catalog
// teaching: map() to transform arrays
function parseCatalog(rawCards) {
return rawCards.map(card => parseCard(card));
Copy link
Contributor

Choose a reason for hiding this comment

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

map won't be taught till later.
so this needs to be refactored.

// teaching: filter(), toLowerCase() for case-insensitive comparison, includes()
function findByAuthor(catalog, author) {
const searchTerm = author.toLowerCase();
return catalog.filter(book =>
Copy link
Contributor

Choose a reason for hiding this comment

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

filter won't be taught till later.
so this needs to be refactored.

// step 4: Group books by decade
// teaching: reduce() to build objects, decade calculation, dynamic object keys
function groupByDecade(catalog) {
return catalog.reduce((grouped, book) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

reduce won't be taught till later.
so this needs to be refactored.


// transform each entry to CSV row
// teaching: handling commas in data, quotes in CSV format
const rows = catalog.map(entry => {
Copy link
Contributor

Choose a reason for hiding this comment

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

map won't be taught till later.
so this needs to be refactored.

console.log("Searching for books by 'Asimov'...");
const asimovBooks = findByAuthor(catalog, "asimov");
console.log(`Found ${asimovBooks.length} book(s):`);
asimovBooks.forEach(book => {
Copy link
Contributor

Choose a reason for hiding this comment

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

forEach won't be taught till later.
so this needs to be refactored.

console.log("Grouping books by decade...");
const byDecade = groupByDecade(catalog);
console.log("Decades represented:");
Object.keys(byDecade).sort().forEach(decade => {
Copy link
Contributor

Choose a reason for hiding this comment

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

forEach won't be taught till later.
so this needs to be refactored.

let validCount = 0;
let invalidCount = 0;

catalog.forEach(entry => {
Copy link
Contributor

Choose a reason for hiding this comment

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

forEach won't be taught till later.
so this needs to be refactored.

Comment on lines +266 to +267
console.log(`Oldest book: ${Math.min(...catalog.filter(b => b.year !== "Unknown").map(b => b.year))}`);
console.log(`Newest book: ${Math.max(...catalog.filter(b => b.year !== "Unknown").map(b => b.year))}`);
Copy link
Contributor

Choose a reason for hiding this comment

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

filter and map won't be taught till later.
so this needs to be refactored.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants