Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

QOL Fixes and Metrics Improvements #258

Merged
merged 33 commits into from
Jan 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
373e4e7
Important admin settings (Semester, Slack Webhooks, Questions URL, Re…
a26blass Dec 23, 2023
d052ba7
add adminSettings.json to gitignore
jacksontromero Dec 26, 2023
cb0b546
fix queue rejoin field on settings page
jacksontromero Dec 26, 2023
4ebed9d
Include locations in saved admin settings
jacksontromero Dec 26, 2023
9d52bf5
respond success works for TAs and Students
jacksontromero Dec 26, 2023
7aecdc1
Show change name button on mobile view
jacksontromero Dec 26, 2023
c1bd90f
Show change name before logout in mobile
jacksontromero Dec 26, 2023
5dab750
Add chart.js
jacksontromero Jan 9, 2024
06eb4ef
Make a bit larger
jacksontromero Jan 9, 2024
5222f84
Fix numStudentsPerDayLastWeek
jacksontromero Jan 9, 2024
620bbcd
Small server-side potential fix for number of students per day last w…
jacksontromero Jan 9, 2024
6c4b9c6
Update metrics queries to work correctly and use charts.js instead of…
jacksontromero Jan 9, 2024
bd1be49
Sort by day of week
jacksontromero Jan 10, 2024
8d5fff7
Use date objects and 8hr windows
jacksontromero Jan 10, 2024
5cb1670
Merge pull request #253 from cmu15122/jtromero/metricsFixes
jacksontromero Jan 10, 2024
7db1879
Account for EST time zone in metrics calculations
jacksontromero Jan 10, 2024
f484612
prevent vertical growth on graphs when resizing page
jacksontromero Jan 10, 2024
35cb11a
Merge pull request #254 from cmu15122/jtromero/metricsFixes
jacksontromero Jan 10, 2024
b39f1d0
Merge pull request #252 from cmu15122/jtromero/preferredNameFixes
jacksontromero Jan 10, 2024
60a0ddf
Change default semester to S23 because of legacy reasons lol
jacksontromero Jan 10, 2024
ae85617
Merge pull request #251 from cmu15122/alexb/persistentsettings
jacksontromero Jan 10, 2024
a767ed6
Add ranked students and TAs to metrics for admins
jacksontromero Jan 13, 2024
85b71ba
Account for current semester and only look at completed questions for…
jacksontromero Jan 13, 2024
7734453
Enforce semester on today's stats
jacksontromero Jan 13, 2024
c300254
Formatting and naming on metrics page
jacksontromero Jan 13, 2024
c29ae2d
Add number of times asked to fix to student rank
jacksontromero Jan 13, 2024
335002a
Remove console.log in metrics.js
jacksontromero Jan 13, 2024
c8919f2
clean up unused imports and other compilation warnings
jacksontromero Jan 13, 2024
529efc6
Merge pull request #255 from cmu15122/jtromero/metricsPolish
jacksontromero Jan 13, 2024
8dd6d98
Add option to enforce CMU email as an admin setting
jacksontromero Jan 13, 2024
3f03d73
Fix pagination with unique keys
jacksontromero Jan 13, 2024
364acca
Merge pull request #256 from cmu15122/jtromero/enforceCMUEmail
jacksontromero Jan 13, 2024
7cff516
Merge pull request #257 from cmu15122/jtromero/fixPersonalStatsPagina…
jacksontromero Jan 13, 2024
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -117,3 +117,4 @@ dist

# Config Files
config.json
adminSettings.json
471 changes: 57 additions & 414 deletions client/package-lock.json

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,19 @@
"@types/react": "^18.0.21",
"@types/react-dom": "^18.0.6",
"axios": "^0.27.2",
"chart.js": "^4.4.1",
"chat.js": "^1.0.2",
"downloadjs": "^1.4.7",
"luxon": "^2.4.0",
"material-react-toastify": "^1.0.1",
"number-to-words": "^1.2.4",
"react": "^18.1.0",
"react-chartjs-2": "^5.2.0",
"react-cookie": "^4.1.1",
"react-dom": "^18.1.0",
"react-router-dom": "^6.3.0",
"react-scripts": "5.0.1",
"react-window": "^1.8.7",
"recharts": "^2.1.13",
"socket.io-client": "^4.5.1",
"styled-components": "^5.3.5",
"typescript": "^4.8.4",
Expand Down
3 changes: 0 additions & 3 deletions client/src/components/home/shared/AskQuestion.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import BaseCard from '../../common/cards/BaseCard';
import HomeService from '../../../services/HomeService';
import {UserDataContext} from '../../../contexts/UserDataContext';
import {QueueDataContext} from '../../../contexts/QueueDataContext';
import {StudentDataContext} from '../../../contexts/StudentDataContext';

function createData(assignment_id, name) {
return {assignment_id, name};
Expand All @@ -34,8 +33,6 @@ export default function AskQuestion() {

const [askDisabled, setAskDisabled] = useState(false);

const {studentData, setStudentData} = useContext(StudentDataContext);

const locations = useMemo(() => {
if (queueData != null) {
const day = date.getDay();
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/home/shared/QueueStats.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, {useContext, useEffect} from 'react';
import React, {useContext} from 'react';
import {
CardContent, Divider, Stack, Typography, useTheme,
} from '@mui/material';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, {useContext, useState} from 'react';
import {
Button, Dialog, DialogContent, FormControl, Input, Link, Stack, Typography,
Button, Dialog, DialogContent, FormControl, Input, Link, Typography,
} from '@mui/material';

import HomeService from '../../../services/HomeService';
Expand Down
3 changes: 1 addition & 2 deletions client/src/components/home/ta/dialogs/FilterOptions.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import React, {useState, useEffect, useContext, useMemo} from 'react';
import React, {useContext, useMemo} from 'react';

import {List, ListSubheader, ListItem,
ListItemButton, ListItemIcon, ListItemText, Checkbox,
} from '@mui/material';

import SettingsService from '../../../../services/SettingsService';
import {QueueDataContext} from '../../../../contexts/QueueDataContext';

function createData(assignment_id, name) {
Expand Down
182 changes: 182 additions & 0 deletions client/src/components/metrics/AdminMetrics.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,182 @@
import React, {useEffect, useState} from 'react';
import MetricsService from '../../services/MetricsService';
import {
Card, Divider, Typography, Stack, Table, TableBody, TableCell,
TableContainer, TableHead, TablePagination, TableRow,
} from '@mui/material';

export default function AdminMetrics() {
const [rankedStudents, setRankedStudents] = useState([]);
const [rankedTAs, setRankedTAs] = useState([]);

// students pagination
const [studentPage, setStudentPage] = useState(0);
const [rowsPerStudentPage, setRowsPerStudentPage] = useState(10);
const handleChangeStudentPage = (event, newPage) => {
setStudentPage(newPage);
};
const handleChangeRowsPerStudentPage = (event) => {
setRowsPerStudentPage(+event.target.value);
setStudentPage(0);
};

// tas pagination
const [taPage, setTAPage] = useState(0);
const [rowsPerTAPage, setRowsPerTAPage] = useState(10);
const handleChangeTAPage = (event, newPage) => {
setTAPage(newPage);
};
const handleChangeRowsPerTAPage = (event) => {
setRowsPerTAPage(+event.target.value);
setTAPage(0);
};

useEffect(() => {
MetricsService.getRankedStudents().then((res) => {
setRankedStudents(res.data.rankedStudents.map((student) => {
return {
...student,
average: Math.round(student.timeHelped / student.count * 10) / 10,
};
}));
});

MetricsService.getRankedTAs().then((res) => {
setRankedTAs(res.data.rankedTAs.map((ta) => {
return {
...ta,
average: Math.round(ta.timeHelping / ta.count * 10) / 10,
};
}));
});
}, []);

const studentCols = [
{id: 'student_andrew', label: 'Andrew ID', width: 25},
{id: 'student_name', label: 'Name', width: 25},
{id: 'count', label: 'Num Questions', width: 100},
{id: 'badCount', label: 'Num Ask to Fix', width: 100},
{id: 'timeHelped', label: 'Total Helping Time (min)', width: 100},
{id: 'average', label: 'Average Helping Time (min)', width: 100},
];

const taCols = [
{id: 'ta_andrew', label: 'Andrew ID', width: 25},
{id: 'ta_name', label: 'Name', width: 25},
{id: 'count', label: 'Num Questions Answered', width: 100},
{id: 'timeHelping', label: 'Total Time Helping (min)', width: 100},
{id: 'average', label: 'Average Time Helping (min)', width: 100},
];

return (
<div style={{margin: 'auto', padding: '10px', width: '90%'}}>
<Typography variant="h5" sx={{my: 4}} fontWeight='bold'>
Ranked Students and Ranked TAs
</Typography>

<Card>
<Stack
direction={{xs: 'column', md: 'row'}}
justifyContent="space-evenly"
alignItems="start"
divider={<Divider orientation="vertical" flexItem/>}
spacing={2}
sx={{m: 2}}
>
<Stack sx={{width: '100%'}}>
<TableContainer sx={{height: 'auto'}}>
<Table stickyHeader aria-label="sticky table">
<TableHead>
<TableRow>
{studentCols.map((column) => (
<TableCell
key={column.id}
style={{width: column.width, textOverflow: 'ellipsis'}}
>
{column.label}
</TableCell>
))}
</TableRow>
</TableHead>
<TableBody>
{rankedStudents
.slice(studentPage * rowsPerStudentPage, studentPage * rowsPerStudentPage + rowsPerStudentPage)
.map((row) => {
return (
<TableRow hover role="checkbox" tabIndex={-1} key={row.student_andrew}>
{studentCols.map((column) => {
const value = row[column.id];
return (
<TableCell key={column.id} sx={{width: 50, textOverflow: 'ellipsis'}}>
{value}
</TableCell>
);
})}
</TableRow>
);
})
}
</TableBody>
</Table>
</TableContainer>
<TablePagination
rowsPerPageOptions={[10, 25, 100]}
component="div"
count={rankedStudents.length}
rowsPerPage={rowsPerStudentPage}
page={studentPage}
onPageChange={handleChangeStudentPage}
onRowsPerPageChange={handleChangeRowsPerStudentPage}
/>
</Stack>
<Stack sx={{width: '100%'}}>
<TableContainer sx={{height: 'auto'}}>
<Table stickyHeader aria-label="sticky table">
<TableHead>
<TableRow>
{taCols.map((column) => (
<TableCell
key={column.id}
style={{width: column.width, textOverflow: 'ellipsis'}}
>
{column.label}
</TableCell>
))}
</TableRow>
</TableHead>
<TableBody>
{rankedTAs
.slice(taPage * rowsPerTAPage, taPage * rowsPerTAPage + rowsPerTAPage)
.map((row) => {
return (
<TableRow hover role="checkbox" tabIndex={-1} key={row.ta_andrew}>
{taCols.map((column) => {
const value = row[column.id];
return (
<TableCell key={column.id} sx={{width: 50, textOverflow: 'ellipsis'}}>
{value}
</TableCell>
);
})}
</TableRow>
);
})
}
</TableBody>
</Table>
</TableContainer>
<TablePagination
rowsPerPageOptions={[10, 25, 100]}
component="div"
count={rankedTAs.length}
rowsPerPage={rowsPerTAPage}
page={taPage}
onPageChange={handleChangeTAPage}
onRowsPerPageChange={handleChangeRowsPerTAPage}
/>
</Stack>
</Stack>
</Card>
</div>
);
}
Loading