Skip to content

Commit

Permalink
semester filter with all semester opition
Browse files Browse the repository at this point in the history
  • Loading branch information
tsun900 committed Nov 13, 2023
1 parent d551e4e commit a5d7091
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/pages/api/get_users.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ async function handler(req, res) {
{
$match: {
$and: [
{ "tenures.semester": { $in: [req.query.semester] } },
{ "tenures.year": { $in: [Number(req.query.year)] } },
req.query.semester == "All" ? {} : { "tenures.semester": { $in: [req.query.semester] } },
req.query.semester == "All" ? {} : { "tenures.year": { $in: [Number(req.query.year)] } },
{
$or: [
{ email: { $regex: new RegExp(query, "i") } },
Expand Down
2 changes: 1 addition & 1 deletion src/screens/AdminDashboard/AdminDashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ const StyledSelect = styled(Select)(() => ({
}));

function AdminDashboardPage({ url }) {
const [semester, setSemester] = useState("Fall 2023");
const [semester, setSemester] = useState("All");
const [department, setDepartment] = useState("All");
const [showUploadModal, setShowUploadModal] = useState(false);
const [fileBlob, setFileBlob] = useState(null);
Expand Down
3 changes: 3 additions & 0 deletions src/screens/AdminDashboard/UserTable/UserTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ import { User } from "../types";
import sendRequest from "../../../server/utils/sendToBackend";

function UserTable({ currentSemester, newMembers, roleFilter, departmentFilter, filter }) {
if (currentSemester == "All") {
currentSemester = "All All";
}
const [userList, setUserList] = useState<User[]>([]);

useEffect(() => {
Expand Down
12 changes: 11 additions & 1 deletion src/server/utils/fields.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,17 @@ const memberTypes = {
2: "Root Admin",
};

const semesterOptions = ["Spring 2020", "Fall 2020", "Spring 2021", "Fall 2021", "Spring 2022", "Fall 2022", "Spring 2023", "Fall 2023"];
const semesterOptions = [
"All",
"Spring 2020",
"Fall 2020",
"Spring 2021",
"Fall 2021",
"Spring 2022",
"Fall 2022",
"Spring 2023",
"Fall 2023",
];

const departments = [
"All",
Expand Down

0 comments on commit a5d7091

Please sign in to comment.