Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stopping profile repetition in ScholarX Archive page #1620

Merged
merged 6 commits into from
Apr 29, 2024
Merged
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions scholarx/archive/functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,16 +60,22 @@ async function getData() {

async function loadData() {
const { data } = await getData();
const mentorNames = new Set(); // Set to store unique mentor names
for (let i = 0; i < data.length; i++) {
years.push(data[i].year)
industries.push(data[i].fields)
years.push(data[i].year);
industries.push(data[i].fields);
if (data[i].type == "mentor") {
mentors.push(data[i])
// Check if the mentor's name is already in the Set
if (!mentorNames.has(data[i].name)) {
mentorNames.add(data[i].name); // Add the mentor's name to the Set
mentors.push(data[i]); // Add the mentor to the mentors array
}
YoshithaRathnayake marked this conversation as resolved.
Show resolved Hide resolved
} else {
mentees.push(data[i])
universities.push(data[i].university)
mentees.push(data[i]);
universities.push(data[i].university);
}
}

//add index for all the items
mentors.forEach(function (mentors, index) {
mentors.index = index;
Expand Down
Loading