Fem-STEM / FemSTEM-Web-App

A web application that serves as an inclusive, supportive tech community focusing strictly on women and non-binaries. Our app offers mentorship opportunities, women-led tutorials, a hall of fame section and an opportunity of finding other female or non-binary teammates.
MIT License
7 stars 13 forks source link

Remove redundancy in find teammates page #27

Closed aashay-03 closed 2 years ago

aashay-03 commented 2 years ago

11

Issue - Repetition of teammates in find teammates page.

Idea - If a teammate is already present in the 'requser' array (array used to store teammates) then don't add the teammate again in the array.

Code

The check of whether a teammate is present in the array or not can be done by looping through the array and comparing the unique _ids of the array items and the current teammate. If a teammate with the same _id is found in the array, then it is not added again, thus preventing repetition.

Also, if there is the same teammate under mentor and mentee, then to show only one of them can be achieved by checking if there is another teammate with the same name and discord id already present in the array. The check can be performed by looping through the array and comparing name and discord ids. If a teammate with the same name and discord id is found in the array then the current teammate is not added.

I have also fixed some minor issues like when the user selects no or only one skill using simple if-else statements as they were part of the same post request and were previously giving wrong results.

Before - There is repetition of teammates and the same teammate under mentor and mentee is displayed twice.

BeforeCode

After code changes - There is no repetition of teammates and the same teammate under mentor and mentee is displayed once.

AfterCode

Swatilekha-Roy commented 2 years ago

Fantastic fantastic job, @aashay-03!! Really impressed by how thorough and in detail your code and pull request are. Keep going!

aashay-03 commented 2 years ago

Thankyou!