Skip to content

Commit

Permalink
Merge branch 'main' into BC-7936-refactor-calendar-test
Browse files Browse the repository at this point in the history
  • Loading branch information
UzaeirKhan committed Oct 17, 2024
2 parents 0549ef9 + 192c24f commit 86f6a4e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
7 changes: 7 additions & 0 deletions controllers/users.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ const express = require('express');
const router = express.Router();
const api = require('../api');
const { setCookie } = require('../helpers/cookieHelper');
const { isUserHidden } = require('../helpers/users');

// users

Expand All @@ -16,12 +17,15 @@ router.get('/teachersOfSchool', async (req, res, next) => {
},
});

users.data = users.data.filter((user) => !isUserHidden(user, res.locals.currentSchoolData));

const result = users.data.map((user) => ({
_id: user._id,
firstName: user.firstName,
lastName: user.lastName,
schoolId: user.schoolId,
email: user.email,
outdatedSince: user.outdatedSince,
}));

return res.json(result);
Expand All @@ -43,11 +47,14 @@ router.get('/teachersWithEmail', async (req, res, next) => {
},
});

users.data = users.data.filter((user) => !isUserHidden(user, res.locals.currentSchoolData));

const result = users.data.map((user) => ({
_id: user._id,
firstName: user.firstName,
lastName: user.lastName,
schoolName: user.schoolId.name,
outdatedSince: user.outdatedSince,
}));

return res.json(result);
Expand Down
5 changes: 3 additions & 2 deletions static/scripts/teamMembers.js
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,8 @@ $(document).ready(() => {
},
}).done((users) => {
users.forEach((user) => {
teacherSelect.append(`<option value="${user._id}">${user.firstName} ${user.lastName}</option>`);
const fullName = `${user.firstName} ${user.lastName}${user.outdatedSince ? ' ~~' : ''}`;
teacherSelect.append(`<option value="${user._id}">${fullName}</option>`);
});
teacherSelect.trigger('chosen:updated');
}).fail(() => {
Expand Down Expand Up @@ -306,7 +307,7 @@ $(document).ready(() => {
teacherSelect.find('option').remove();

users.forEach((user) => {
const displayText = `${user.firstName} ${user.lastName} - ${user.schoolName}`;
const displayText = `${user.firstName} ${user.lastName}${user.outdatedSince ? ' ~~' : ''} - ${user.schoolName}`;
teacherSelect.append(`<option value="${user._id}">${displayText}</option>`);
});
teacherSelect.trigger('chosen:updated');
Expand Down

0 comments on commit 86f6a4e

Please sign in to comment.