Skip to content

feat: add a prototype for the Guild Loot Tracker workshop#1078

Open
Sebastian-Wlo wants to merge 21 commits into
freeCodeCamp:mainfrom
Sebastian-Wlo:lab-nutrient-tracker-dictionary
Open

feat: add a prototype for the Guild Loot Tracker workshop#1078
Sebastian-Wlo wants to merge 21 commits into
freeCodeCamp:mainfrom
Sebastian-Wlo:lab-nutrient-tracker-dictionary

Conversation

@Sebastian-Wlo

@Sebastian-Wlo Sebastian-Wlo commented Dec 15, 2025

Copy link
Copy Markdown

Checklist:

Relates to: freeCodeCamp/freeCodeCamp#64119

  • link to the related issue: Workshop – Guild Loot Tracker freeCodeCamp#64119 ,
  • currently, the prototype uses for() loops and Array.prototype.sort() method,
  • I couldn't figure out how to use "Object.values()" in the functions (maybe adding a function returning the sums of ingredient macros to the requirements would be a good place to implement it?)

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 jdwilkin4 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 👍🏾

@Sebastian-Wlo

Copy link
Copy Markdown
Author

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 listTopIngredients(), which was supposed to return sorted output requires the use of a loop. sort() would be ideal, but it should be doable with just a for() loop (I'd definitely need to make some changes to make it work).

So, Loops would probably be the right place for it.

Thank you, I'll add the user stories as soon as I can.

@majestic-owl448

Copy link
Copy Markdown
Contributor

you can use those from the issue as base, and update as needed based on changes that have been made

@Sebastian-Wlo Sebastian-Wlo deleted the lab-nutrient-tracker-dictionary branch December 16, 2025 14:08
@Sebastian-Wlo Sebastian-Wlo restored the lab-nutrient-tracker-dictionary branch December 16, 2025 14:08
@Sebastian-Wlo

Sebastian-Wlo commented Dec 16, 2025

Copy link
Copy Markdown
Author

Sorry! I tried to rename the branch without thinking what it would do to the PR.

user-stories.md has been added

@Sebastian-Wlo Sebastian-Wlo reopened this Dec 16, 2025
@majestic-owl448

Copy link
Copy Markdown
Contributor

wouldn't this project have a similar issue to the nutrient tracker that we are replacing because potentially triggering?

@Sebastian-Wlo

Copy link
Copy Markdown
Author

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.
It's possible that I misinterpreted the response, but the way I understood it was that this could still be useful, but maybe after changing its subject.

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.

@majestic-owl448

Copy link
Copy Markdown
Contributor

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.
@Sebastian-Wlo

Copy link
Copy Markdown
Author

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 getMemberTotals() is the only function that returns a string while the other return objects (incidentally, it is unfortunately the only point where I managed to find a use for Object.values() in). I hope that at least one approach is good, and can be applied to the rest of the functions.

Should I request another review for this?

@jdwilkin4 jdwilkin4 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

Comment thread fullstack-cert/js-projects/lab-guild-loot-tracker/user-stories.md Outdated
Comment thread fullstack-cert/js-projects/lab-guild-loot-tracker/user-stories.md Outdated
Comment thread fullstack-cert/js-projects/lab-guild-loot-tracker/user-stories.md Outdated
Comment thread fullstack-cert/js-projects/lab-guild-loot-tracker/user-stories.md Outdated
@jdwilkin4

Copy link
Copy Markdown
Contributor

Also, please update your PR title since the project was changed 👍🏾

@Sebastian-Wlo Sebastian-Wlo changed the title feat: add a prototype for the Nutrient Tracker Dictionary lab feat: add a prototype for the Guild Loot Tracker lab Dec 24, 2025
@Sebastian-Wlo Sebastian-Wlo marked this pull request as draft March 19, 2026 02:53
@Sebastian-Wlo

Copy link
Copy Markdown
Author

First of all, I'm really sorry it took me so long to add any updates.

I'm still not happy with the addLootEntry() and cloneGuildData() functions. I understand what purpose creating a shallow copy of the object is supposed to have, but it currently doesn't really add anything.
Another thing that doesn't seem right is the inconsistency between returning values and using console.log()s in the functions. I'm not sure which would work better - it seems like returning strings and logging them to the console would be the best solution, but I'm not sure if this makes the most sense here.

I hope to keep working on this, but I'd really appreciate any pointers on how to turn this into a actually useful workshop

@Jeevankumar-s Jeevankumar-s added the Naomi's Sprint This task is being assigned to a contributor as part of Naomi's managed sprints on Discord. label Mar 23, 2026
@jdwilkin4

Copy link
Copy Markdown
Contributor

@Sebastian-Wlo

it would probably be best to open up a thread on discord under naomi's sprints channel.
That way we can hash this out get more clarity on the core objectives for this lab.

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.
@Sebastian-Wlo

Copy link
Copy Markdown
Author

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) TODOs in the current version, are there any glaring mistakes that need to be addressed?

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 was thinking about using the names of the fCC staff, like it's been done in some of the previous workshops, but it didn't feel comfortable with assigning people reputation and experience arbitrarily. Would it be okay if I did that? I don't want anyone to be offended about the "stats" I'm assigning here

Comment thread fullstack-cert/js-projects/guild-loot-tracker/script.js
@jdwilkin4

Copy link
Copy Markdown
Contributor

I was thinking about using the names of the fCC staff, like it's been done in some of the previous workshops, but it didn't feel comfortable with assigning people reputation and experience arbitrarily. Would it be okay if I did that? I don't want anyone to be offended about the "stats" I'm assigning here

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.

@jdwilkin4 jdwilkin4 moved this from Backlog to In progress in Naomi's Contribution Sprints Apr 28, 2026
@jdwilkin4 jdwilkin4 removed the BLOCKED label Apr 28, 2026
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.
@Sebastian-Wlo

Copy link
Copy Markdown
Author

Thank you @jdwilkin4 , that list solves my problem with names!
I still need to clean up the comments and note how to divide the code into steps (I'll try to do that within the next day or two), but most of the current version is hopefully ready for the review.

One thing I was thinking about is getting rid of the listMemberNames() function and introducing both Object.keys() and Object.values() in the listMembers().
I'll stick to making any suggested changes (instead of rewriting functions because I randomly came up with a better solution), but I'd like to know if removing listMemberNames() is a good idea, or if introducing these two methods in separate functions would be a cleaner way to present them.

@jdwilkin4

Copy link
Copy Markdown
Contributor

but I'd like to know if removing listMemberNames() is a good idea, or if introducing these two methods in separate functions would be a cleaner way to present them.

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 listMemberNames. 👍🏾

This updates the overview of how "Guild Loot Tracker" workshop should be broken down into steps.
@Sebastian-Wlo Sebastian-Wlo marked this pull request as ready for review May 24, 2026 23:12
@Sebastian-Wlo

Copy link
Copy Markdown
Author

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.
I don't expect the prototype to pass the review on the first go, but hopefully some of it will be usable:)

@jdwilkin4 jdwilkin4 changed the title feat: add a prototype for the Guild Loot Tracker lab feat: add a prototype for the Guild Loot Tracker workshop Jun 2, 2026
@jdwilkin4 jdwilkin4 added workshop and removed lab This work is for the labs team only labels Jun 2, 2026

@jdwilkin4 jdwilkin4 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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);

@Sebastian-Wlo

Copy link
Copy Markdown
Author

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:)
It's a shame that object cloning didn't make the cut, but it makes sense to keep the scope of the workshop more focused on a specific subject.

I like how much cleaner it looks! But there are 2 things I'd like to ask about before rewriting it:

  1. Should reputation be left without any function modifying the values? It's fine, it's an exercise and not an actual management app after all (and it keeps this workshop less repetitive), but it does look a little odd to have a value and no way to change it,
  2. Would it be ok to separate the "headers" of the function responses (so, "Guild Members:", "Gold Totals:" etc) from the rest of the output with ------------ and functions with just console.log("")? Either that, or removing the lines altogether - they look nice, but it's easy to get the number of characters wrong, so maybe it would be better to avoid adding them in multiple places

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

Labels

awaiting update full stack cert Naomi's Sprint This task is being assigned to a contributor as part of Naomi's managed sprints on Discord. workshop

Projects

Status: In progress

Development

Successfully merging this pull request may close these issues.

5 participants