Temp fix for showing supervisor groups

This commit is contained in:
adam-skowronek 2023-01-06 19:41:42 +01:00
parent dd76f23a8c
commit df107cfc7d

View File

@ -14,6 +14,7 @@ const SupervisorGroups = () => {
const [page, setPage] = useState(1)
const [perPage, setPerPage] = useState(10)
const [yearGroupId] = useLocalStorageState('yearGroupId')
const [userId] = useLocalStorageState('userId')
const perPageOptions = [
{
@ -96,40 +97,44 @@ const SupervisorGroups = () => {
</tr>
</thead>
<tbody className="divide-y divide-gray-100">
{groups?.data?.groups?.map(
({
id,
name,
project_supervisor,
points_for_first_term,
points_for_second_term,
}) => (
<tr key={id}>
<td>
<Link
to={`/${
location.pathname.includes('coordinator')
? 'coordinator'
: 'supervisor'
}/groups/${id}`}
className="underline font-bold"
>
{name}
</Link>
</td>
<td>
{`${project_supervisor.first_name} ${project_supervisor.last_name}`}
</td>
<td>{points_for_first_term}</td>
<td>{points_for_second_term}</td>
<td>
<button onClick={() => mutateDelete(id)}>
<IconRemove />
</button>
</td>
</tr>
),
)}
{groups?.data?.groups
?.filter(
({ project_supervisor }) => project_supervisor.id === userId,
)
.map(
({
id,
name,
project_supervisor,
points_for_first_term,
points_for_second_term,
}) => (
<tr key={id}>
<td>
<Link
to={`/${
location.pathname.includes('coordinator')
? 'coordinator'
: 'supervisor'
}/groups/${id}`}
className="underline font-bold"
>
{name}
</Link>
</td>
<td>
{`${project_supervisor.first_name} ${project_supervisor.last_name}`}
</td>
<td>{points_for_first_term}</td>
<td>{points_for_second_term}</td>
<td>
<button onClick={() => mutateDelete(id)}>
<IconRemove />
</button>
</td>
</tr>
),
)}
</tbody>
</table>
</div>