Skip to content

Commit

Permalink
New members migration patch
Browse files Browse the repository at this point in the history
  • Loading branch information
Goose-Of-War committed Jun 30, 2023
1 parent 5db157e commit 4191063
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 3 deletions.
2 changes: 1 addition & 1 deletion database/handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ async function updatePoll (ctx) {
}

async function getMembersbyYear (year) {
const data = await Member.find({ 'records.year': year }).sort('name').lean();
const data = await Member.find({ 'records.year': ~~year }).sort('name').lean();
const yearData = [];
const teamsData = require('../src/teams.json');
data.forEach(member => {
Expand Down
2 changes: 1 addition & 1 deletion routes/members.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const dbh = PARAMS.mongoless ? {} : require('../database/handler');
const sample = require('../src/samples/members');

router.get('/:yearName?', async (req, res) => {
const yearName = parseInt(req.params.yearName) || 2022;
const yearName = ~~Object.keys(require('../src/teams.json')).sort().pop();
const membersData = PARAMS.mongoless ? sample : await dbh.getMembersbyYear(yearName);
const status = {
'Governors': [],
Expand Down
24 changes: 23 additions & 1 deletion src/teams.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,5 +60,27 @@
"name": "WebDev",
"icon": "webdev"
}
},
"2023" : {
"a": {
"name": "AMV & Music",
"icon": "amv"
},
"d": {
"name": "Design & Arts",
"icon": "design"
},
"n": {
"name": "Media & Newsletter",
"icon": "newsletter"
},
"q": {
"name": "Quiz",
"icon": "quiz"
},
"w": {
"name": "WebDev",
"icon": "webdev"
}
}
}
}

0 comments on commit 4191063

Please sign in to comment.