Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

58 changes: 58 additions & 0 deletions .idea/codeStyles/Project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions .idea/codeStyles/codeStyleConfig.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

39 changes: 39 additions & 0 deletions .idea/csm_web.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/inspectionProfiles/profiles_settings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/prettier.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 18 additions & 3 deletions ci/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
appnope==1.0.0 ; python_full_version >= "3.12.4" and python_full_version < "3.13.0" and platform_system == "Darwin"
asgiref==3.8.1 ; python_full_version >= "3.12.4" and python_full_version < "3.13.0"
asttokens==3.0.0 ; python_full_version >= "3.12.4" and python_full_version < "3.13.0"
boto3==1.37.1 ; python_full_version >= "3.12.4" and python_full_version < "3.13.0"
botocore==1.37.1 ; python_full_version >= "3.12.4" and python_full_version < "3.13.0"
certifi==2025.1.31 ; python_full_version >= "3.12.4" and python_full_version < "3.13.0"
cffi==1.17.1 ; python_full_version >= "3.12.4" and python_full_version < "3.13.0" and platform_python_implementation != "PyPy"
cffi==1.17.1 ; python_full_version >= "3.12.4" and python_full_version < "3.13.0" and (implementation_name == "pypy" or platform_python_implementation != "PyPy")
charset-normalizer==3.4.1 ; python_full_version >= "3.12.4" and python_full_version < "3.13.0"
colorama==0.4.6 ; python_full_version >= "3.12.4" and python_full_version < "3.13.0" and sys_platform == "win32"
comm==0.2.3 ; python_full_version >= "3.12.4" and python_full_version < "3.13.0"
cryptography==44.0.1 ; python_full_version >= "3.12.4" and python_full_version < "3.13.0"
debugpy==1.8.22 ; python_full_version >= "3.12.4" and python_full_version < "3.13.0"
decorator==5.2.1 ; python_full_version >= "3.12.4" and python_full_version < "3.13.0"
defusedxml==0.7.1 ; python_full_version >= "3.12.4" and python_full_version < "3.13.0"
dj-database-url==2.3.0 ; python_full_version >= "3.12.4" and python_full_version < "3.13.0"
Expand All @@ -15,8 +18,11 @@ django-extensions==3.2.3 ; python_full_version >= "3.12.4" and python_full_versi
django-on-heroku==1.1.2 ; python_full_version >= "3.12.4" and python_full_version < "3.13.0"
django-postgres-extra==2.0.9rc11 ; python_full_version >= "3.12.4" and python_full_version < "3.13.0"
django-storages==1.14.5 ; python_full_version >= "3.12.4" and python_full_version < "3.13.0"
django-stubs-ext==6.1.1 ; python_full_version >= "3.12.4" and python_full_version < "3.13.0"
django-stubs==6.1.1 ; python_full_version >= "3.12.4" and python_full_version < "3.13.0"
django==5.1.6 ; python_full_version >= "3.12.4" and python_full_version < "3.13.0"
djangorestframework-camel-case==1.4.2 ; python_full_version >= "3.12.4" and python_full_version < "3.13.0"
djangorestframework-stubs==3.18.1 ; python_full_version >= "3.12.4" and python_full_version < "3.13.0"
djangorestframework==3.15.2 ; python_full_version >= "3.12.4" and python_full_version < "3.13.0"
drf-nested-forms==1.1.8 ; python_full_version >= "3.12.4" and python_full_version < "3.13.0"
executing==2.2.0 ; python_full_version >= "3.12.4" and python_full_version < "3.13.0"
Expand All @@ -26,27 +32,34 @@ freezegun==1.5.1 ; python_full_version >= "3.12.4" and python_full_version < "3.
gunicorn==22.0.0 ; python_full_version >= "3.12.4" and python_full_version < "3.13.0"
idna==3.10 ; python_full_version >= "3.12.4" and python_full_version < "3.13.0"
iniconfig==2.0.0 ; python_full_version >= "3.12.4" and python_full_version < "3.13.0"
ipykernel==7.3.0 ; python_full_version >= "3.12.4" and python_full_version < "3.13.0"
ipython==8.32.0 ; python_full_version >= "3.12.4" and python_full_version < "3.13.0"
jedi==0.19.2 ; python_full_version >= "3.12.4" and python_full_version < "3.13.0"
jmespath==1.0.1 ; python_full_version >= "3.12.4" and python_full_version < "3.13.0"
jupyter-client==8.10.0 ; python_full_version >= "3.12.4" and python_full_version < "3.13.0"
jupyter-core==5.9.1 ; python_full_version >= "3.12.4" and python_full_version < "3.13.0"
matplotlib-inline==0.1.7 ; python_full_version >= "3.12.4" and python_full_version < "3.13.0"
nest-asyncio2==1.7.3 ; python_full_version >= "3.12.4" and python_full_version < "3.13.0"
networkx==3.4.2 ; python_full_version >= "3.12.4" and python_full_version < "3.13.0"
oauthlib==3.2.2 ; python_full_version >= "3.12.4" and python_full_version < "3.13.0"
packaging==24.2 ; python_full_version >= "3.12.4" and python_full_version < "3.13.0"
parso==0.8.4 ; python_full_version >= "3.12.4" and python_full_version < "3.13.0"
pexpect==4.9.0 ; python_full_version >= "3.12.4" and python_full_version < "3.13.0" and (sys_platform != "win32" and sys_platform != "emscripten")
platformdirs==4.3.6 ; python_full_version >= "3.12.4" and python_full_version < "3.13.0"
pluggy==1.5.0 ; python_full_version >= "3.12.4" and python_full_version < "3.13.0"
prompt-toolkit==3.0.50 ; python_full_version >= "3.12.4" and python_full_version < "3.13.0"
psutil==7.2.2 ; python_full_version >= "3.12.4" and python_full_version < "3.13.0"
psycopg2-binary==2.9.10 ; python_full_version >= "3.12.4" and python_full_version < "3.13.0"
ptyprocess==0.7.0 ; python_full_version >= "3.12.4" and python_full_version < "3.13.0" and (sys_platform != "win32" and sys_platform != "emscripten")
pure-eval==0.2.3 ; python_full_version >= "3.12.4" and python_full_version < "3.13.0"
pycparser==2.22 ; python_full_version >= "3.12.4" and python_full_version < "3.13.0" and platform_python_implementation != "PyPy"
pycparser==2.22 ; python_full_version >= "3.12.4" and python_full_version < "3.13.0" and (implementation_name == "pypy" or platform_python_implementation != "PyPy")
pygments==2.19.1 ; python_full_version >= "3.12.4" and python_full_version < "3.13.0"
pyjwt==2.10.1 ; python_full_version >= "3.12.4" and python_full_version < "3.13.0"
pytest-django==4.10.0 ; python_full_version >= "3.12.4" and python_full_version < "3.13.0"
pytest==8.3.4 ; python_full_version >= "3.12.4" and python_full_version < "3.13.0"
python-dateutil==2.9.0.post0 ; python_full_version >= "3.12.4" and python_full_version < "3.13.0"
python3-openid==3.2.0 ; python_full_version >= "3.12.4" and python_full_version < "3.13.0"
pyzmq==27.2.0 ; python_full_version >= "3.12.4" and python_full_version < "3.13.0"
requests-oauthlib==2.0.0 ; python_full_version >= "3.12.4" and python_full_version < "3.13.0"
requests==2.32.3 ; python_full_version >= "3.12.4" and python_full_version < "3.13.0"
s3transfer==0.11.2 ; python_full_version >= "3.12.4" and python_full_version < "3.13.0"
Expand All @@ -56,8 +69,10 @@ social-auth-app-django==5.4.3 ; python_full_version >= "3.12.4" and python_full_
social-auth-core==4.5.6 ; python_full_version >= "3.12.4" and python_full_version < "3.13.0"
sqlparse==0.5.3 ; python_full_version >= "3.12.4" and python_full_version < "3.13.0"
stack-data==0.6.3 ; python_full_version >= "3.12.4" and python_full_version < "3.13.0"
tornado==6.5.10 ; python_full_version >= "3.12.4" and python_full_version < "3.13.0"
traitlets==5.14.3 ; python_full_version >= "3.12.4" and python_full_version < "3.13.0"
typing-extensions==4.12.2 ; python_full_version >= "3.12.4" and python_full_version < "3.13.0"
types-pyyaml==6.0.12.20260906 ; python_full_version >= "3.12.4" and python_full_version < "3.13.0"
typing-extensions==4.16.0 ; python_full_version >= "3.12.4" and python_full_version < "3.13.0"
tzdata==2025.1 ; python_full_version >= "3.12.4" and python_full_version < "3.13.0"
urllib3==2.3.0 ; python_full_version >= "3.12.4" and python_full_version < "3.13.0"
wcwidth==0.2.13 ; python_full_version >= "3.12.4" and python_full_version < "3.13.0"
Expand Down
46 changes: 45 additions & 1 deletion csm_web/frontend/src/components/section/MentorSectionRoster.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useState } from "react";

import { useSectionStudents } from "../../utils/queries/sections";
import { useSectionStudents, useSectionWaitlistedStudents } from "../../utils/queries/sections";
import LoadingSpinner from "../LoadingSpinner";

import CheckCircle from "../../../static/frontend/img/check_circle.svg";
Expand All @@ -13,6 +13,13 @@ interface MentorSectionRosterProps {
export default function MentorSectionRoster({ id }: MentorSectionRosterProps) {
const { data: students, isSuccess: studentsLoaded, isError: studentsLoadError } = useSectionStudents(id);
const [emailsCopied, setEmailsCopied] = useState(false);
const {
data: wlStudents,
isSuccess: wlStudentsLoaded,
isError: wlStudentsLoadError
} = useSectionWaitlistedStudents(id);
const [wlEmailsCopied, wlSetEmailsCopied] = useState(false);

const handleCopyEmails = () => {
if (studentsLoaded) {
navigator.clipboard.writeText(students.map(({ email }) => email).join("\n")).then(() => {
Expand All @@ -21,6 +28,14 @@ export default function MentorSectionRoster({ id }: MentorSectionRosterProps) {
});
}
};
const wlHandleCopyEmails = () => {
if (wlStudentsLoaded) {
navigator.clipboard.writeText(wlStudents.map(({ email }) => email).join("\n")).then(() => {
wlSetEmailsCopied(true);
setTimeout(() => wlSetEmailsCopied(false), 1500);
});
}
};
return (
<React.Fragment>
<h3 className="section-detail-page-title">Roster</h3>
Expand Down Expand Up @@ -50,6 +65,35 @@ export default function MentorSectionRoster({ id }: MentorSectionRosterProps) {
) : (
<LoadingSpinner />
)}
{wlStudentsLoaded && wlStudents && wlStudents.length > 0 && (
<React.Fragment>
<div style={{ height: "40px" }} />
<h3 className="section-detail-page-title">Waitlisted</h3>
<table className="csm-table standalone">
<thead className="csm-table-head">
<tr className="csm-table-head-row">
<th className="csm-table-item">Position</th>
<th className="csm-table-item">Name</th>
<th className="csm-table-item">Email</th>
<th className="csm-table-item">
<CopyIcon id="copy-student-emails" height="1em" width="1em" onClick={wlHandleCopyEmails} />
{wlEmailsCopied && <CheckCircle id="copy-student-emails-success" height="1em" width="1em" />}
</th>
</tr>
</thead>
<tbody>
{wlStudents.map(({ position, name, email, id }) => (
<tr key={id} className="csm-table-row">
<td className="csm-table-item">{position}</td>
<td className="csm-table-item">{name}</td>
<td className="csm-table-item">{email}</td>
</tr>
))}
</tbody>
</table>
</React.Fragment>
)}{" "}
{wlStudentsLoadError && <h3>Waitlisted students could not be loaded</h3>}
</React.Fragment>
);
}
8 changes: 4 additions & 4 deletions csm_web/frontend/src/utils/queries/sections.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import { useMutation, UseMutationResult, useQuery, useQueryClient, UseQueryResult } from "@tanstack/react-query";
import { fetchNormalized, fetchWithMethod, HTTP_METHODS } from "../api";
import { Attendance, RawAttendance, Section, Spacetime, Student } from "../types";
import { Attendance, RawAttendance, Section, Spacetime, Student, WaitlistedStudent } from "../types";
import { handleError, handlePermissionsError, handleRetry, PermissionError, ServerError } from "./helpers";

/* ===== Queries ===== */
Expand Down Expand Up @@ -71,8 +71,8 @@ export const useSectionStudents = (id: number): UseQueryResult<Student[], Server
* Tries query-param first; if that fails, falls back to /sections/:id/waitlisted.
* Returns students sorted by name.
*/
export const useSectionWaitlistedStudents = (id: number): UseQueryResult<Student[], ServerError> => {
const queryResult = useQuery<Student[], Error>(
export const useSectionWaitlistedStudents = (id: number): UseQueryResult<WaitlistedStudent[], ServerError> => {
const queryResult = useQuery<WaitlistedStudent[], Error>(
["sections", id, "waitlisted-students"],
async () => {
if (isNaN(id)) {
Expand All @@ -82,7 +82,7 @@ export const useSectionWaitlistedStudents = (id: number): UseQueryResult<Student
const resp1 = await fetchNormalized(`/waitlist/${id}/`);
if (resp1.ok) {
const students = await resp1.json();
return students.sort((a: Student, b: Student) => a.name.toLowerCase().localeCompare(b.name.toLowerCase()));
return students.sort((a: WaitlistedStudent, b: WaitlistedStudent) => a.position > b.position);
}

// if (resp1.status === 404) {
Expand Down
7 changes: 7 additions & 0 deletions csm_web/frontend/src/utils/types.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,13 @@ export interface Student {
email: string;
}

export interface WaitlistedStudent {
id: number;
name: string;
email: string;
position: number;
}

export enum AttendancePresence {
EX = "EX",
PR = "PR",
Expand Down
7 changes: 6 additions & 1 deletion csm_web/scheduler/factories.py
Original file line number Diff line number Diff line change
Expand Up @@ -603,12 +603,17 @@ def generate_test_data(preconfirm=False):
)
user_objects.extend(waitlisted_users)
waitlisted_students = []
wl_position = 1
for waitlisted_user in waitlisted_users:
waitlisted_students.append(
WaitlistedStudentFactory.build(
section=section, course=course, user=waitlisted_user
section=section,
course=course,
user=waitlisted_user,
position=wl_position,
)
)
wl_position = wl_position + 1
waitlisted_student_objects.extend(waitlisted_students)

# courses with many sections/students
Expand Down
Loading
Loading