onChange('endDate', e.target.value)}
- className={getInputClass('endDate', isEditing, user.role)}
- disabled={!canEditField('endDate', isEditing, user.role)}
+ className={getInputClass('endDate', isEditing, user.endDate)}
+ disabled={!canEditField('endDate', isEditing, user.endDate)}
/>
diff --git a/src/pages/search/StudentSearchView.jsx b/src/pages/search/StudentSearchView.jsx
index b23d4b2..29f3654 100644
--- a/src/pages/search/StudentSearchView.jsx
+++ b/src/pages/search/StudentSearchView.jsx
@@ -107,7 +107,7 @@ const StudentSearchView = () => {
{u.firstName} {u.lastName}
{/* Empty cohorts get a random cohort to ensure nice formatting */}
- {u.cohort ? u.cohort : 'Software Developer, Cohort 69'}
+ {u.cohort.title ? u.cohort.title : 'Software Developer, Cohort 69'}
navigate(`/profile/${u.id}`)}>
Profile
@@ -133,7 +133,7 @@ const StudentSearchView = () => {
{u.firstName} {u.lastName}
{/* Empty cohorts get a random cohort to ensure nice formatting */}
-
{u.cohort ? u.cohort : 'Software Developer, Cohort 69'}
+
{u.cohort.title ? u.cohort.title : 'Software Developer, Cohort 69'}
= {}): TestUserD
// number of milliseconds in one day
const ONE_DAY = 24 * 60 * 60 * 1000;
- const startDate = overrides.startDate ?? new Date(saltSeed + 7 * ONE_DAY); // 7 days in the future
- const endDate = overrides.endDate ?? new Date(saltSeed + 14 * ONE_DAY); // 14 days in the future
+ const startDate = overrides.cohort?.startDate ?? new Date(saltSeed + 7 * ONE_DAY); // 7 days in the future
+ const endDate = overrides.cohort?.endDate ?? new Date(saltSeed + 14 * ONE_DAY); // 14 days in the future
const salt = overrides.username ?? `test-user-${saltSeed}`;
@@ -39,9 +42,12 @@ export const getNewTestUser = (overrides: Partial = {}): TestUserD
mobile: overrides.mobile ?? '+4712345678',
role: overrides.role ?? 0,
specialism: overrides.specialism ?? `Test-developer ${saltSeed}`,
- cohort: overrides.cohort ?? 'Cohort 1',
- startDate,
- endDate,
+ cohort: {
+ id:1,
+ title: 'Cohort 1',
+ startDate: startDate,
+ endDate: endDate
+ },
bio: overrides.bio ?? `Test-developer bio with salt: ${saltSeed}`
};
};