diff --git a/src/pages/applications/index.tsx b/src/pages/applications/index.tsx index 63d08e01..67a490b4 100644 --- a/src/pages/applications/index.tsx +++ b/src/pages/applications/index.tsx @@ -4,6 +4,14 @@ import { IOnlineGroup } from 'groups/models/onlinegroup'; import React, { useEffect, useState } from 'react'; import style from '../../applications/committee.less'; +import crypto from 'crypto'; + +const getHourlyUpdatedSortKey = (key: string) => { + const hash = crypto.createHash('sha256'); + const hour = Math.floor((+new Date()) / 3600000); + hash.update(key + hour.toString()); + return hash.digest('hex'); +} const Committees: React.FC = () => { const [committees, setCommittees] = useState([]); @@ -21,7 +29,11 @@ const Committees: React.FC = () => { ) { CommitteeList.push(groups[i]); } - } + } + + CommitteeList.sort((a, b) => { + return getHourlyUpdatedSortKey(a.name_short) > getHourlyUpdatedSortKey(b.name_short) ? 1 : -1; + }); setCommittees(CommitteeList); }); }, []); @@ -31,7 +43,7 @@ const Committees: React.FC = () => {
Komitémedlemmene våre får Online til å gå rundt, og arbeider for at alle informatikkstudenter skal ha en flott studiehverdag. -
Her kan du søke om å bli en av oss! + {/*
Her kan du søke om å bli en av oss! */ }
{committees.map((com) => { return ( @@ -42,11 +54,13 @@ const Committees: React.FC = () => { ); })} + {/*
Trykk her for å sende inn en søknad!
+ */} ); };