Skip to content

Commit

Permalink
Stopping profile repetition in ScholarX Archive page (#1620)
Browse files Browse the repository at this point in the history
  • Loading branch information
RamithaHeshan33 authored Apr 29, 2024
1 parent cd812d9 commit 49c1050
Showing 1 changed file with 11 additions and 5 deletions.
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

0 comments on commit 49c1050

Please sign in to comment.