-
-
Notifications
You must be signed in to change notification settings - Fork 141
feat: add heritage library catalog workshop #1096
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
feat: add heritage library catalog workshop #1096
Conversation
…porting functionalities
|
Please confirm where this workshop is supposed to go in the curriculum. |
|
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"
]
}, |
jdwilkin4
left a comment
There was a problem hiding this 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()); |
There was a problem hiding this comment.
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)); |
There was a problem hiding this comment.
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 => |
There was a problem hiding this comment.
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) => { |
There was a problem hiding this comment.
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 => { |
There was a problem hiding this comment.
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 => { |
There was a problem hiding this comment.
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 => { |
There was a problem hiding this comment.
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 => { |
There was a problem hiding this comment.
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(`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))}`); |
There was a problem hiding this comment.
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.
Checklist:
Update index.md)References this issue.