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

WIP: Deactivated riders should not be assigned to rides #504

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
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
11 changes: 9 additions & 2 deletions frontend/src/components/RideModal/Pages/RiderInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const RiderInfoPage = ({ formData, onBack, onSubmit }: ModalPageProps) => {
const [locationToId, setLocationToId] = useState<ObjectType>({});
const { locations } = useLocations();
const { riders } = useRiders();
const filteredRiders = riders.filter((r) => r.active == true);

const beforeSubmit = ({ name, pickupLoc, dropoffLoc }: ObjectType) => {
const rider = nameToId[name.toLowerCase()];
Expand All @@ -30,7 +31,7 @@ const RiderInfoPage = ({ formData, onBack, onSubmit }: ModalPageProps) => {
};

useEffect(() => {
const nameToIdObj = riders.reduce((acc: ObjectType, r: Rider) => {
const nameToIdObj = filteredRiders.reduce((acc: ObjectType, r: Rider) => {
const fullName = `${r.firstName} ${r.lastName}`.toLowerCase();
acc[fullName] = r.id;
return acc;
Expand Down Expand Up @@ -64,7 +65,13 @@ const RiderInfoPage = ({ formData, onBack, onSubmit }: ModalPageProps) => {
/>
{errors.name && <p className={styles.error}>Rider not found</p>}
<datalist id="names">
{riders.map((r) => (
{/* people.filter((person) => person.name !== 'John') */}
{/* {riders.filter((r) => (
<option key={r.id}>
{r.firstName} {r.lastName}
</option>
))} */}
{filteredRiders.map((r) => (
<option key={r.id}>
{r.firstName} {r.lastName}
</option>
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/UserTables/StudentsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ const StudentsTable = ({ searchName }: studentTableProps) => {
endDate
)}`;
const usageData = getUsageData(id);
const isStudentInvalid = moment().isAfter(moment(endDate)) && active;
const isStudentInvalid = moment().isAfter(moment(endDate)) && !active;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be || instead of &&.

const location = {
pathname: `/riders/${r.id}`,
};
Expand Down
Loading