feat: add a prototype for the Guild Loot Tracker workshop#1078
feat: add a prototype for the Guild Loot Tracker workshop#1078Sebastian-Wlo wants to merge 21 commits into
Conversation
This adds a prototype for the Nutrient Tracker Dictionary lab. Currently, the prototype uses "for()" loops and ".sort()" method. Couldn't figure out how to use "Object.values()" in the functions.
jdwilkin4
left a comment
There was a problem hiding this comment.
Please make to include the user stories so those can be review too just in case updates need to be made there.
Also, please let us know where this falls in the curriuclum.
loops module?
review modules?
higher order functions?
we will need that information when conducting reviews 👍🏾
|
Just to make sure: should the user stories be a copy of those mentioned in the related issue, or should I come up with some new ones? As for where this lab should be placed in the curriculum - originally, it was supposed to be in the Objects module. But I think So, Loops would probably be the right place for it. Thank you, I'll add the user stories as soon as I can. |
|
you can use those from the issue as base, and update as needed based on changes that have been made |
|
Sorry! I tried to rename the branch without thinking what it would do to the PR.
|
|
wouldn't this project have a similar issue to the nutrient tracker that we are replacing because potentially triggering? |
Possibly, in the current form at least - someone actually pointed it out after I chose the issue. I'm not sure if it means I should come up with a different theme (I'm not the most creative person out there, so it might take some time), or leave the prototype as if for now and wait for a review. |
|
there are many other things that could be tracked in a pretty similar way, so the prototype is still good, there will be need to change the name of some things before it's ready tho |
Changed "lab-nutrient-tracker-dictionary" to "lab-guild-loot-tracker" to fit the new topic for the Lab.
Changes all references in "user-stories.md" from nutrient tracking to guild loot management, and "dictionaries" to "objects".
Changed references "nutrient tracking" references in "script.js" to tracking guild loot management.
|
The overall "theme" has been changed to a new one (thank you once more @naomi-lgbt, if it wasn't for you, I would have been stuck at coming up with something for some time). It will definitely need changes, since Should I request another review for this? |
jdwilkin4
left a comment
There was a problem hiding this comment.
I left some thoughts on the user stories.
But also noticed that none of these functions are being used anywhere.
From an educational standpoint, we don't want to send the message to beginners to create functions in their code and not use it. All of these functions should be used in some way so campers can connect the dots and see what is actually happening in the code. Even if it is just logging these function call results to the console.
|
Also, please update your PR title since the project was changed 👍🏾 |
|
First of all, I'm really sorry it took me so long to add any updates. I'm still not happy with the I hope to keep working on this, but I'd really appreciate any pointers on how to turn this into a actually useful workshop |
|
it would probably be best to open up a thread on discord under naomi's sprints channel. |
This renames the directory the code is contained in. It's done to avoid potential confusion, since the purpose of this prototype changed from a Lab to a Workshop.
This changes the getMemberTotals() so it either return an object including the member's resources or `false` if the guild object doesn't include that member.
…', add coments This changes the way the "main" functions of the script work., and adds comments to make describing the workshop's steps easier.
|
Terribly sorry it took so long! I've unfortunately been really busy. Sorry the prototype is not up to an acceptable level. Aside from from all of the (too many) During the conversation in the Naomi's sprints channel it turned out that it's not clear the names I've used for the guild members are actually names (which I should have seen coming, to be honest). |
I left a comment regarding the names. But in general, some of the staff would probably be fine having their names in the curriculum while others might not. So using fake yet more realistic names should be fine here. |
This changes the names used in the workshop to less cunfusing ones (Thank you Jessica for the list!).
…for consistency This changes the 'for' loop in listMemberNames() to a 'for...in' loop to keep the used loops consistent, and adds the use of 'parseInt' to that loop. Also, adds missing semicolons to listMembers() function (probably should've made it into a separate commit).
… of checks This changes the loop used for iteration over guild member's names to 'for...in' loop (for consistency), and moves the check if the new entry before updating the member data.
|
Thank you @jdwilkin4 , that list solves my problem with names! One thing I was thinking about is getting rid of the |
We can try the separate functions and then through the review process if we decide it doesn't work as well, we go back to the |
This updates the overview of how "Guild Loot Tracker" workshop should be broken down into steps.
|
Once again, sorry it took so long - I was too optimistic about how much time I'd have this week... On the upside, I think all of the changes I wanted to make are done, and hopefully the steps breakdown is reasonably clear. |
jdwilkin4
left a comment
There was a problem hiding this comment.
After reviewing this and seeing this will be a workshop after the profile lookup lab, I would suggest simplifying this and keeping the core learning concepts to working with Object.keys(), Object.values(), and Object.entries()
Here is my proposed update
const guild = {
ethan: {
gold: 31,
reputation: 9,
},
elara: {
gold: 78,
reputation: 12,
},
brandon: {
gold: 41,
reputation: 7,
},
dylan: {
gold: 81,
reputation: 20,
},
};
function listMembers(guildObject) {
console.log("Guild Members:");
const members = Object.keys(guildObject);
for (const member of members) {
console.log(member);
}
}
listMembers(guild);
console.log("------------");
function countMembers(guildObject) {
return Object.keys(guildObject).length;
}
console.log(`Guild Members: ${countMembers(guild)}`);
console.log("------------");
function listGold(guildObject) {
console.log("Gold Totals:");
for (const [name, stats] of Object.entries(guildObject)) {
console.log(`${name}: ${stats.gold} gold`);
}
}
listGold(guild);
console.log("------------");
function getTotalGold(guildObject) {
let totalGold = 0;
for (const member of Object.values(guildObject)) {
totalGold += member.gold;
}
return totalGold;
}
console.log(`Total Gold: ${getTotalGold(guild)}`);
console.log("------------");
function getRichestMember(guildObject) {
let richestName = "";
let highestGold = 0;
for (const [name, stats] of Object.entries(guildObject)) {
if (stats.gold > highestGold) {
highestGold = stats.gold;
richestName = name;
}
}
return richestName;
}
console.log(`Richest Member: ${getRichestMember(guild)}`);
console.log("------------");
function listVeterans(guildObject) {
console.log("Veteran Members:");
for (const [name, stats] of Object.entries(guildObject)) {
if (stats.reputation >= 10) {
console.log(name);
}
}
}
listVeterans(guild);
console.log("------------");
function awardGold(guildObject, amount) {
for (const member of Object.values(guildObject)) {
member.gold += amount;
}
}
awardGold(guild, 10);
console.log("After Awarding 10 Gold:");
listGold(guild);
console.log("------------");
function guildReport(guildObject) {
console.log("Guild Report");
console.log("------------");
console.log(`Members: ${countMembers(guildObject)}`);
console.log(`Total Gold: ${getTotalGold(guildObject)}`);
console.log(`Richest Member: ${getRichestMember(guildObject)}`);
}
guildReport(guild);|
That's quite a departure from the current version, but it makes sense considering the whole idea was moved to a different section, as well as from a lab to a workshop:) I like how much cleaner it looks! But there are 2 things I'd like to ask about before rewriting it:
|
Checklist:
Update index.md)Relates to: freeCodeCamp/freeCodeCamp#64119
for()loops andArray.prototype.sort()method,