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 all 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 mentorName = 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 using the title
if (!mentorName.has(data[i].title)) {
mentorName.add(data[i].title); // Add the mentor's title to the Set
mentors.push(data[i]); // Add the mentor to the mentors array
}
} 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