Nerds-Who-Code / Mental-Health-Tracker

mental-health-tracker.vercel.app
MIT License
6 stars 6 forks source link

Bugfix show multiple events in entry #40

Closed steph-koopmanschap closed 2 years ago

steph-koopmanschap commented 2 years ago

There was a bug on the ViewEntriesPage.js inside Entry.js
The bug was that only 1 event would be shown. Even if the user added multiple events to their entry in AddEntryPage.js

The problem was in the AddEntryPage.js. Even if the user selected multiple event checkboxes. Only 1 would actually register and be stored on the server.

Took me about 3 hours and a lot of trial and errors to finally fix this haha. But I learned a lot. Not sure if its the most elegant code, but it works. I tried 3 different variations of the code, but none worked.

The solution was to map all the check boxes individual checked or unchecked states into a boolean array. Then check which ones are checked and unchecked and map that to actual strings of what the event is.

There is now a new bug where the comma is still shown after the last event.