From 7bfb2464744006772ba727f6bb0793753dda52e4 Mon Sep 17 00:00:00 2001
From: Andreas Ellewsen <ae@uio.no>
Date: Mon, 1 Nov 2021 15:04:30 +0100
Subject: [PATCH] Adjust status logic in frontend

The status column now signifies if the role on that line is active or
not.
---
 frontend/src/routes/sponsor/frontpage/index.tsx | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/frontend/src/routes/sponsor/frontpage/index.tsx b/frontend/src/routes/sponsor/frontpage/index.tsx
index feddce80..225481b5 100644
--- a/frontend/src/routes/sponsor/frontpage/index.tsx
+++ b/frontend/src/routes/sponsor/frontpage/index.tsx
@@ -18,7 +18,8 @@ import Page from 'components/page'
 import { useTranslation } from 'react-i18next'
 import { Link } from 'react-router-dom'
 import { Guest, Role } from 'interfaces'
-import format from 'date-fns/format'
+import { isBefore, format } from 'date-fns'
+
 import SponsorGuestButtons from '../../components/sponsorGuestButtons'
 
 interface GuestProps {
@@ -43,7 +44,8 @@ const PersonLine = ({
   cancelCallback,
 }: PersonLineProps) => {
   const [t, i18n] = useTranslation(['common'])
-
+  const today = new Date()
+  today.setHours(0, 0, 0, 0)
   return (
     <TableRow
       key={`${person.first} ${person.last}`}
@@ -57,7 +59,7 @@ const PersonLine = ({
       </TableCell>
 
       {showStatusColumn &&
-        (person.active ? (
+        (!isBefore(role.end_date, today) ? (
           <TableCell sx={{ color: 'green' }} align="left">
             {t('common:active')}
           </TableCell>
-- 
GitLab