Skip to content

Conversation

@claraiskssn
Copy link

@claraiskssn claraiskssn commented Oct 18, 2022

Hello

Detta är min tema- och kontorsvärdsgenerator som använder sig utav localStorage för att hålla koll på vilka teman och kontorsvärdar som varit så att de inte blir igen förrän alla varit. Men min kod är lite ful tycker jag! Jag skulle uppskatta något så oerhört om ni ville kika igenom koden och peka ut lite grejer vad jag gör för fel och vad jag kan göra annorlunda/tänka på för att bli bättre!

Jag har markerat i koden (den senaste committen) vart jag speciellt behöver hjälp, markeringen ser ut såhär:
/*
! CODE REVIEW !
blablabla
*/
koden jag behöver hjälp med

Förstår om ni har ont om tid för att hålla på o hjälpa mig med sånt här, men skulle tid finnas någon gång så skulle jag bli jätteglad som sagt ⭐

Clara Isaksson and others added 26 commits September 6, 2022 16:16
… theme does not get selected or randomised when it has been selected or randomised once before.
…from the selectable or randomisable themes until the themes array is empty.
…s now get stored in local storage in an array called usedEmployees
… hook that stores theme and employees instead of doing it in app.js
…domised cannot be chosen/randomised again, until their respective arrays run out, then they begin anew. Everything works as expected except that people who are re-randomised through dice press cannot get randomly become an office host again.
…h the user manually choosing a theme from the dropdown menu, the de-selected theme re-enters the original themes array and disappears from the localStorage, so it can be both randomised and picked again.
…tored themes array rather than the second to last theme when a user manually selects a new theme from the dropdown.
…ser through picking a new theme from the dropdown menu is now put back into the choosable and randomisable themes array.
… press is now removed from the local storage, yet to be added back into the employees array.
…that splices the clonedThemes that exist in storedThemes isn't waterproof, sometimes themes that do exist in storedThemes suddenly pop up in clonedThemes as well... one person can become both of the office hosts because the chosen employees don't get spliced out of the clonedEmployees array until both office hosts have been set. Even though an employee has become an office host and is set in storedEmployees they can still become office host once again, and I think it's because clonedEmployees takes in the whole employees array each render?
…fice hosts into a switch case. All the bugs are still there + I uncovered a new one: if there are office hosts stored in the local storage prior to when a user re-randomises an office host through a dice press the entire local storage of employees is replaced with the current office hosts.
…emoved from the themes array from which the user can choose and randomise new themes from.
…ployees array so users cannot choose or randomise them again.
…s array is safely restored, making the tombola re-start
…ution to removing a deselected person from the local storage and storedEmployees array.
…Array to make them available for a re-randomisation
… new theme from the dropdown are now removed from local storage and storedThemes
…me manually from the dropdown are now re-added into the themesArray. The issue with identical keys within the dropdown is also solved. Similarily to the stored employees the themes are now transformed into only the property of theme rather than the whole object.
@claraiskssn claraiskssn requested review from moke20 and simonahlstrom and removed request for moke20 October 18, 2022 14:18
@claraiskssn claraiskssn removed the request for review from simonahlstrom October 18, 2022 14:20
… of employees and instead tried to be explicit with that these are not employees, these are how the person components should be rendered when no employee has been chosen, when the employee is loading and when the employee is set to an actual employee. Don't know if the code became better or worse really. It felt like it became longer
…ing the user to randomise both office hosts simultaneously)
… to get stored multiple times if the app re-renders + cleaned up a few other things
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants