Skip to content

Commit

Permalink
fix(schedules): don’t display warning when viewing only schedule
Browse files Browse the repository at this point in the history
  • Loading branch information
rhahao committed Sep 29, 2023
1 parent 74a944b commit 73a9990
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

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

4 changes: 2 additions & 2 deletions src/features/schedules/PersonSelect.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -249,13 +249,13 @@ const PersonSelect = ({
useEffect(() => {
setHasWarning(false);

if (selectedPerson !== null) {
if (selectedPerson !== null && edit) {
const activeRecords = Schedules.history.filter(
(record) => record.weekOf === currentWeek && record.studentID === selectedPerson.person_uid
);
setHasWarning(activeRecords.length > 1);
}
}, [assID, selectedPerson, currentWeek, refreshCurrent]);
}, [assID, selectedPerson, currentWeek, refreshCurrent, edit]);

return (
<HtmlTooltip
Expand Down

0 comments on commit 73a9990

Please sign in to comment.