Skip to content
This repository has been archived by the owner on Nov 20, 2024. It is now read-only.

Commit

Permalink
Sort Member by Entering year and Alphabetical order + Graduations by …
Browse files Browse the repository at this point in the history
…Graduation Year
  • Loading branch information
iclab committed Mar 26, 2024
1 parent 45e8ec1 commit 4e0e4fb
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 19 deletions.
34 changes: 17 additions & 17 deletions data/members.ts
Original file line number Diff line number Diff line change
Expand Up @@ -347,23 +347,23 @@ const members: { [key: string]: Member } = {
email: '[email protected]',
homepage: 'https://yong-shin.github.io/',
},
JeungminOh: {
name: 'Jeungmin Oh',
role: "Alumni",
email: "[email protected]",
current_affiliation: 'Hayan Mind',
histories: {
"Ph.D. Student": "2012.02 ~ LOA"
}
},
EugeneLee: {
name: 'Eugene Lee',
role: "Alumni",
email: '[email protected]',
histories: {
"M.S. Student": "2021.03 ~ LOA"
}
},
// JeungminOh: {
// name: 'Jeungmin Oh',
// role: "Alumni",
// email: "[email protected]",
// current_affiliation: 'Hayan Mind',
// histories: {
// "Ph.D. Student": "2012.02 ~ LOA"
// }
// },
// EugeneLee: {
// name: 'Eugene Lee',
// role: "Alumni",
// email: '[email protected]',
// histories: {
// "M.S. Student": "2021.03 ~ LOA"
// }
// },
CheulyoungPark: {
name: 'Cheulyoung Park',
role: "Alumni",
Expand Down
28 changes: 26 additions & 2 deletions src/app/members/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,35 @@ const Page: React.FC = () => {
return (
<div key={role} className={styles.program}>
<h3>{role}</h3>
<div className={role!=="Alumni"? styles.program_member:''}>
<div className={role !== "Alumni" ? styles.program_member : ''}>
{
Object.entries(members)
.filter(([_, member]) => member.role === role)
.sort(([_name1,a],[_name2,b]) => a.name.localeCompare(b.name))
.sort(([_name1, a], [_name2, b]) => {
const last1 = a.name.split(" ")[1];
const last2 = b.name.split(" ")[1];
let enter1 = ""
let enter2 = ""
if (role !== "Alumni") {
enter1 = a.histories[role].split(" ")[0];
enter2 = b.histories[role].split(" ")[0];
} else {//Alumni we will use graduate year for sorting
enter1 = Object.entries(a.histories).map(
([_, period]) => period.split(" ")[2])
.sort((a, b) => a.localeCompare(b))[0];
enter2 = Object.entries(b.histories).map(
([_, period]) => period.split(" ")[2])[0];
}
if (enter1 === enter2) {
return last1.localeCompare(last2)
} else {
if(role === "Alumni"){
return enter2.localeCompare(enter1)
}else{
return enter1.localeCompare(enter2)
}
}
})
.map(([key, member]) =>
<Member key={key} member={member} />
)
Expand Down

0 comments on commit 4e0e4fb

Please sign in to comment.